Files
MyGoNavi/internal/db/timeout_policy_test.go
Syngnat 32dfd39827 🐛 fix(query): 放开所有数据源默认查询超时
- 区分连接超时与查询超时,默认查询仅保留手动取消能力
- 清理各数据库及 HTTP 数据源由连接配置派生的请求超时
- 新增按请求 queryTimeout 透传并保留计数任务显式时限
- 补充前后端、缓存键与多驱动超时策略回归测试
2026-08-06 16:50:28 +08:00

35 lines
929 B
Go

package db
import (
"net/http"
"testing"
"GoNavi-Wails/internal/connection"
)
func TestHTTPDataSourceClientsDoNotUseConnectTimeoutAsRequestTimeout(t *testing.T) {
config := connection.ConnectionConfig{Timeout: 1}
tests := []struct {
name string
build func(connection.ConnectionConfig) *http.Client
}{
{name: "chroma", build: buildChromaHTTPClient},
{name: "qdrant", build: buildQdrantHTTPClient},
{name: "milvus", build: buildMilvusHTTPClient},
{name: "rabbitmq", build: buildRabbitMQHTTPClient},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := tt.build(config)
if client.Timeout != 0 {
t.Fatalf("connection timeout leaked into HTTP request timeout: %s", client.Timeout)
}
transport, ok := client.Transport.(*http.Transport)
if !ok || transport.DialContext == nil {
t.Fatal("expected HTTP transport to retain a bounded connection dial")
}
})
}
}