Skip to content

Commit 6424c85

Browse files
janiszclaude
andcommitted
fix: remove duplicate getToolsets and use app.GetToolsets
Remove duplicate getToolsets function from main_test.go and use the exported app.GetToolsets instead. Also remove the duplicate TestGetToolsets test which will be enhanced in app_test.go. Addresses PR #50 review comment #2 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 07f2802 commit 6424c85

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

cmd/stackrox-mcp/main_test.go

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,15 @@ import (
99
"testing"
1010
"time"
1111

12+
"github.com/stackrox/stackrox-mcp/internal/app"
1213
"github.com/stackrox/stackrox-mcp/internal/client"
1314
"github.com/stackrox/stackrox-mcp/internal/config"
1415
"github.com/stackrox/stackrox-mcp/internal/server"
1516
"github.com/stackrox/stackrox-mcp/internal/testutil"
1617
"github.com/stackrox/stackrox-mcp/internal/toolsets"
17-
toolsetConfig "github.com/stackrox/stackrox-mcp/internal/toolsets/config"
18-
toolsetVulnerability "github.com/stackrox/stackrox-mcp/internal/toolsets/vulnerability"
19-
"github.com/stretchr/testify/assert"
2018
"github.com/stretchr/testify/require"
2119
)
2220

23-
// getToolsets initializes and returns all available toolsets.
24-
func getToolsets(cfg *config.Config, c *client.Client) []toolsets.Toolset {
25-
return []toolsets.Toolset{
26-
toolsetConfig.NewToolset(cfg, c),
27-
toolsetVulnerability.NewToolset(cfg, c),
28-
}
29-
}
30-
31-
func TestGetToolsets(t *testing.T) {
32-
allToolsets := getToolsets(&config.Config{}, &client.Client{})
33-
34-
toolsetNames := []string{}
35-
for _, toolset := range allToolsets {
36-
toolsetNames = append(toolsetNames, toolset.GetName())
37-
}
38-
39-
assert.Contains(t, toolsetNames, "config_manager")
40-
assert.Contains(t, toolsetNames, "vulnerability")
41-
}
42-
4321
func TestGracefulShutdown(t *testing.T) {
4422
// Set up minimal valid config. config.LoadConfig() validates configuration.
4523
t.Setenv("STACKROX_MCP__TOOLS__VULNERABILITY__ENABLED", "true")
@@ -49,7 +27,7 @@ func TestGracefulShutdown(t *testing.T) {
4927
require.NotNil(t, cfg)
5028
cfg.Server.Port = testutil.GetPortForTest(t)
5129

52-
registry := toolsets.NewRegistry(cfg, getToolsets(cfg, &client.Client{}))
30+
registry := toolsets.NewRegistry(cfg, app.GetToolsets(cfg, &client.Client{}))
5331
srv := server.NewServer(cfg, registry)
5432
ctx, cancel := context.WithCancel(context.Background())
5533

0 commit comments

Comments
 (0)