RunTest 运行测试
()
| 155 | |
| 156 | // RunTest 运行测试 |
| 157 | func RunTest() { |
| 158 | // 加载环境变量 |
| 159 | if _, err := os.Stat(".envkm"); err == nil { |
| 160 | // 如果存在.envkm文件,则加载它 |
| 161 | if err := godotenv.Load(".envkm"); err != nil { |
| 162 | logger.SysLogf("警告: 加载.envkm文件失败: %v", err) |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | // 设置测试环境变量(如果未设置) |
| 167 | if os.Getenv("VECTOR_DB_TYPE") == "" { |
| 168 | os.Setenv("VECTOR_DB_TYPE", "qdrant") |
| 169 | } |
| 170 | if os.Getenv("VECTOR_DB_URL") == "" { |
| 171 | os.Setenv("VECTOR_DB_URL", "http://localhost:6333") |
| 172 | } |
| 173 | if os.Getenv("VECTOR_DB_API_KEY") == "" { |
| 174 | os.Setenv("VECTOR_DB_API_KEY", "difyai123456") |
| 175 | } |
| 176 | |
| 177 | if err := TestBasicFunctionality(); err != nil { |
| 178 | logger.SysLogf("测试失败: %v", err) |
| 179 | os.Exit(1) |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | // TestEmbeddingServiceIntegration 测试EmbeddingService集成 |
| 184 | func TestEmbeddingServiceIntegration() error { |
nothing calls this directly
no test coverage detected