47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
//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)
|
|
}
|
|
}
|
|
}
|