INNER CODE UNIT · Go
TestToolCatalogGETDoesNotConstructDisabledAgentDependencies
VersusControl/versus-incident · cmd/tool_availability_test.go:19
func TestToolCatalogGETDoesNotConstructDisabledAgentDependencies(t *testing.T) {
for _, aiEnabled := range []bool{false, true} {
t.Run(map[bool]string{false: "AI disabled", true: "AI enabled with invalid construction config"}[aiEnabled], func(t *testing.T) {
cfg := config.AgentConfig{
Enable: false,
AI: config.AgentAIConfig{Enable: aiEnabled, Provider: "invalid-provider", Model: "invalid-model"},
Sources: []config.AgentSourceConfig{{Name: "broken", Type: "invalid-source", Enable: true}},
Tools: config.ToolsConfig{Kubernetes: config.KubernetesToolConfig{
Endpoint: "https://cluster.example",
Auth: config.KubernetesAuthConfig{Mode: "invalid"},
}},
}
app := fiber.New()
app.Use(func(ctx *fiber.Ctx) error { middleware.MarkAuthorized(ctx); return ctx.Next() })
app.Use(middleware.OrgInjector())
availability := agent.NewToolAvailabilityService(cfg, storage.NewMemory())
service, constructionErr := agent.NewKubernetesService(cfg.Tools.Kubernetes, tenancy.DefaultOrgScope())
if constructionErr == nil {