chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,46 @@
|
||||
package container
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
func TestBuildMilvusClientConfig_UsesDatabaseName(t *testing.T) {
|
||||
cfg := buildMilvusClientConfig(types.ConnectionConfig{
|
||||
Addr: "milvus.example.com:19530",
|
||||
Username: "tester",
|
||||
Password: "secret",
|
||||
Database: "regdi_ram_haom1",
|
||||
})
|
||||
|
||||
if cfg.Address != "milvus.example.com:19530" {
|
||||
t.Fatalf("expected address to be preserved, got %q", cfg.Address)
|
||||
}
|
||||
if cfg.Username != "tester" {
|
||||
t.Fatalf("expected username to be preserved, got %q", cfg.Username)
|
||||
}
|
||||
if cfg.Password != "secret" {
|
||||
t.Fatalf("expected password to be preserved, got %q", cfg.Password)
|
||||
}
|
||||
if cfg.DBName != "regdi_ram_haom1" {
|
||||
t.Fatalf("expected DBName to be propagated, got %q", cfg.DBName)
|
||||
}
|
||||
if len(cfg.DialOptions) != 2 {
|
||||
t.Fatalf("expected timeout and SSRF-safe dial options, got %d", len(cfg.DialOptions))
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildMilvusClientConfig_DefaultsAddressWhenMissing(t *testing.T) {
|
||||
cfg := buildMilvusClientConfig(types.ConnectionConfig{})
|
||||
|
||||
if cfg.Address != "localhost:19530" {
|
||||
t.Fatalf("expected default address localhost:19530, got %q", cfg.Address)
|
||||
}
|
||||
if cfg.DBName != "" {
|
||||
t.Fatalf("expected empty DBName by default, got %q", cfg.DBName)
|
||||
}
|
||||
if len(cfg.DialOptions) != 2 {
|
||||
t.Fatalf("expected timeout and SSRF-safe dial options, got %d", len(cfg.DialOptions))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user