- DEFAULT_CHAIN_ADMISSION.md: reviewed and approved, real artifact refs added - DEFAULT_DATA_IDEMPOTENT_RELEASE_GATE.md: reviewed and approved - scripts/setup_default_data.sh: idempotent init with --dry-run/--apply/artifact - scripts/test/test_default_data.sh: 4 test cases all pass - scripts/acceptance/verify_user_key_self_service.sh: Phase 0 skeleton - .gitignore: add generated artifact directories
77 lines
2.2 KiB
Go
77 lines
2.2 KiB
Go
package sub2api
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"sub2api-cn-relay-manager/internal/probe"
|
|
)
|
|
|
|
func TestBuildCapabilityInventoryClassifiesSupportedWithAdapter(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
inventory := BuildCapabilityInventory(
|
|
HostCapabilities{
|
|
Groups: true,
|
|
Channels: true,
|
|
Plans: true,
|
|
Accounts: true,
|
|
AccountTest: true,
|
|
AccountModels: true,
|
|
Subscriptions: true,
|
|
},
|
|
&probe.CapabilityProfile{
|
|
TransportProfile: probe.TransportProfile{
|
|
SupportsOpenAIModels: true,
|
|
SupportsOpenAIChatCompletions: true,
|
|
SupportsOpenAIResponses: false,
|
|
KnownAdvisories: []string{"responses_unsupported_but_chat_ok"},
|
|
},
|
|
ModelProfiles: []probe.ModelCapabilityProfile{{
|
|
RawModelID: "kimi-k2.6",
|
|
CanonicalModelFamily: "kimi-k2.6",
|
|
SmokeChatOK: true,
|
|
}},
|
|
},
|
|
)
|
|
|
|
if !inventory.HostReady {
|
|
t.Fatal("HostReady = false, want true")
|
|
}
|
|
if len(inventory.Models) != 1 {
|
|
t.Fatalf("len(Models) = %d, want 1", len(inventory.Models))
|
|
}
|
|
if inventory.Models[0].SupportLevel != SupportLevelWithPluginAdapter {
|
|
t.Fatalf("SupportLevel = %q, want %q", inventory.Models[0].SupportLevel, SupportLevelWithPluginAdapter)
|
|
}
|
|
}
|
|
|
|
func TestBuildCapabilityInventoryClassifiesUpstreamUnhealthy(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
inventory := BuildCapabilityInventory(
|
|
HostCapabilities{Groups: true, Channels: true, Accounts: true, AccountTest: false},
|
|
&probe.CapabilityProfile{
|
|
TransportProfile: probe.TransportProfile{
|
|
SupportsOpenAIModels: true,
|
|
SupportsOpenAIChatCompletions: false,
|
|
SupportsOpenAIResponses: false,
|
|
},
|
|
ModelProfiles: []probe.ModelCapabilityProfile{{
|
|
RawModelID: "glm-4.5",
|
|
CanonicalModelFamily: "glm-4.5",
|
|
SmokeChatOK: false,
|
|
}},
|
|
},
|
|
)
|
|
|
|
if inventory.HostReady {
|
|
t.Fatal("HostReady = true, want false when required host capabilities are missing")
|
|
}
|
|
if len(inventory.Models) != 1 {
|
|
t.Fatalf("len(Models) = %d, want 1", len(inventory.Models))
|
|
}
|
|
if inventory.Models[0].SupportLevel != SupportLevelUpstreamUnhealthy {
|
|
t.Fatalf("SupportLevel = %q, want %q", inventory.Models[0].SupportLevel, SupportLevelUpstreamUnhealthy)
|
|
}
|
|
}
|