feat(import): persist official model release metadata
This commit is contained in:
46
scripts/official_import_scripts_test.go
Normal file
46
scripts/official_import_scripts_test.go
Normal file
@@ -0,0 +1,46 @@
|
||||
//go:build llm_script
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestOfficialImportScriptsWriteModelSourceURLAndReleaseDate(t *testing.T) {
|
||||
projectRoot, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatalf("getwd: %v", err)
|
||||
}
|
||||
|
||||
scriptDir := projectRoot
|
||||
if filepath.Base(projectRoot) != "scripts" {
|
||||
scriptDir = filepath.Join(projectRoot, "scripts")
|
||||
}
|
||||
|
||||
scripts := []string{
|
||||
"import_phase2_data.go",
|
||||
"import_zhipu_data.go",
|
||||
"import_bytedance_data.go",
|
||||
}
|
||||
|
||||
for _, relativePath := range scripts {
|
||||
contentBytes, err := os.ReadFile(filepath.Join(scriptDir, relativePath))
|
||||
if err != nil {
|
||||
t.Fatalf("read %s: %v", relativePath, err)
|
||||
}
|
||||
content := string(contentBytes)
|
||||
|
||||
if !strings.Contains(content, "INSERT INTO models") {
|
||||
t.Fatalf("%s missing models insert statement", relativePath)
|
||||
}
|
||||
if !strings.Contains(content, "source_url") {
|
||||
t.Fatalf("%s missing source_url in models write path", relativePath)
|
||||
}
|
||||
if !strings.Contains(content, "release_date") {
|
||||
t.Fatalf("%s missing release_date in models write path", relativePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user