Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions e2e/service_provisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestProvisionMCPService(t *testing.T) {
Version: "latest",
HostIds: []controlplane.Identifier{controlplane.Identifier(host1)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-test-key-12345",
Expand Down Expand Up @@ -184,6 +185,7 @@ func TestProvisionMultiHostMCPService(t *testing.T) {
controlplane.Identifier(host3),
},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "openai",
"llm_model": "gpt-4",
"openai_api_key": "sk-test-key-67890",
Expand Down Expand Up @@ -285,6 +287,7 @@ func TestUpdateDatabaseAddService(t *testing.T) {
Version: "latest",
HostIds: []controlplane.Identifier{controlplane.Identifier(host2)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "ollama",
"llm_model": "llama2",
"ollama_url": "http://localhost:11434",
Expand Down Expand Up @@ -350,6 +353,7 @@ func TestProvisionMCPServiceUnsupportedVersion(t *testing.T) {
Version: "99.99.99", // Valid semver but not registered in ServiceVersions
HostIds: []controlplane.Identifier{controlplane.Identifier(host1)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-test-key-12345",
Expand Down Expand Up @@ -454,6 +458,7 @@ func TestProvisionMCPServiceRecovery(t *testing.T) {
Version: "99.99.99", // Unsupported version - workflow will fail
HostIds: []controlplane.Identifier{controlplane.Identifier(host1)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-test-key-12345",
Expand Down Expand Up @@ -541,6 +546,7 @@ func TestProvisionMCPServiceRecovery(t *testing.T) {
Version: "latest", // Corrected version
HostIds: []controlplane.Identifier{controlplane.Identifier(host1)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-test-key-12345",
Expand Down Expand Up @@ -650,6 +656,7 @@ func TestUpdateDatabaseServiceStable(t *testing.T) {
Version: "latest",
HostIds: []controlplane.Identifier{controlplane.Identifier(host1)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-test-key-stable",
Expand Down Expand Up @@ -718,6 +725,7 @@ func TestUpdateDatabaseServiceStable(t *testing.T) {
Version: "latest",
HostIds: []controlplane.Identifier{controlplane.Identifier(host1)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-test-key-stable",
Expand Down Expand Up @@ -788,6 +796,7 @@ func TestUpdateMCPServiceConfig(t *testing.T) {
Version: "latest",
HostIds: []controlplane.Identifier{controlplane.Identifier(host1)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-test-key-config",
Expand Down Expand Up @@ -850,6 +859,7 @@ func TestUpdateMCPServiceConfig(t *testing.T) {
Version: "latest",
HostIds: []controlplane.Identifier{controlplane.Identifier(host1)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-haiku-4-5",
"anthropic_api_key": "sk-ant-test-key-config",
Expand Down Expand Up @@ -929,6 +939,7 @@ func TestUpdateDatabaseRemoveService(t *testing.T) {
Version: "latest",
HostIds: []controlplane.Identifier{controlplane.Identifier(host1)},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-test",
Expand Down
30 changes: 29 additions & 1 deletion server/internal/api/apiv1/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ func TestValidateDatabaseSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand Down Expand Up @@ -605,6 +606,7 @@ func TestValidateDatabaseSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -616,6 +618,7 @@ func TestValidateDatabaseSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-2"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand Down Expand Up @@ -647,6 +650,7 @@ func TestValidateDatabaseSpec(t *testing.T) {
Version: "v1.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "unknown",
},
},
Expand Down Expand Up @@ -677,6 +681,7 @@ func TestValidateDatabaseSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "unknown",
},
},
Expand Down Expand Up @@ -771,6 +776,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1", "host-2"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -785,6 +791,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "2.1.3",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "openai",
"llm_model": "gpt-4",
"openai_api_key": "sk-...",
Expand All @@ -799,6 +806,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.5.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "ollama",
"llm_model": "llama2",
"ollama_url": "http://localhost:11434",
Expand All @@ -813,6 +821,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "latest",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -827,6 +836,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -843,6 +853,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand Down Expand Up @@ -945,6 +956,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "v1.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -962,6 +974,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1", "host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -979,6 +992,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host 1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -996,7 +1010,8 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_model": "claude-sonnet-4-5",
"llm_enabled": true,
"llm_model": "claude-sonnet-4-5",
},
},
expected: []string{
Expand All @@ -1011,6 +1026,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
},
},
Expand All @@ -1026,6 +1042,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "unknown",
"llm_model": "some-model",
},
Expand All @@ -1042,6 +1059,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
},
Expand All @@ -1058,6 +1076,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "openai",
"llm_model": "gpt-4",
},
Expand All @@ -1074,6 +1093,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "ollama",
"llm_model": "llama2",
},
Expand All @@ -1090,6 +1110,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -1108,6 +1129,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -1126,6 +1148,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -1148,6 +1171,7 @@ func TestValidateServiceSpec(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand Down Expand Up @@ -1288,6 +1312,7 @@ func TestValidateServiceSpec_DatabaseConnectionCrossValidation(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -1308,6 +1333,7 @@ func TestValidateServiceSpec_DatabaseConnectionCrossValidation(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand All @@ -1328,6 +1354,7 @@ func TestValidateServiceSpec_DatabaseConnectionCrossValidation(t *testing.T) {
Version: "1.0.0",
HostIds: []api.Identifier{"host-1"},
Config: map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand Down Expand Up @@ -1421,6 +1448,7 @@ func TestValidateOrchestratorOpts(t *testing.T) {
func TestValidateDatabaseUpdate_ServiceBootstrapFields(t *testing.T) {
// A minimal valid MCP config shared across test cases.
validMCPConfig := map[string]any{
"llm_enabled": true,
"llm_provider": "anthropic",
"llm_model": "claude-sonnet-4-5",
"anthropic_api_key": "sk-ant-...",
Expand Down
Loading