feat(vnext): complete vNext.1 release gate — default chain admission, idempotent init, user key skeleton
- 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
This commit is contained in:
76
internal/host/sub2api/capability_inventory_test.go
Normal file
76
internal/host/sub2api/capability_inventory_test.go
Normal file
@@ -0,0 +1,76 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user