Release v1.4.7 with unlimited default timeout

This commit is contained in:
lutc5
2026-05-06 16:29:35 +08:00
parent fe1d5b5348
commit 22f793c188
13 changed files with 73 additions and 25 deletions

View File

@@ -4,8 +4,23 @@ import (
"os"
"path/filepath"
"testing"
"time"
)
func TestNewKeepsZeroTimeoutUnlimited(t *testing.T) {
client := New(Config{Timeout: 0})
if client.client.Timeout != 0 {
t.Fatalf("timeout = %v, want 0", client.client.Timeout)
}
}
func TestNewKeepsPositiveTimeout(t *testing.T) {
client := New(Config{Timeout: 7 * time.Second})
if client.client.Timeout != 7*time.Second {
t.Fatalf("timeout = %v, want 7s", client.client.Timeout)
}
}
func TestExtractBaseURLFromEndpointLog(t *testing.T) {
got := extractBaseURLFromText(`2026-04-10 INFO Update endpoint success. endpoint config: https://ai-lingma-cmb01-cn-beijing.rdc.aliyuncs.com`)
want := "https://ai-lingma-cmb01-cn-beijing.rdc.aliyuncs.com"