TestNoDuplicateToolNames ensures all tools have unique names
(t *testing.T)
| 104 | |
| 105 | // TestNoDuplicateToolNames ensures all tools have unique names |
| 106 | func TestNoDuplicateToolNames(t *testing.T) { |
| 107 | tools := AllTools(stubTranslation) |
| 108 | seen := make(map[string]bool) |
| 109 | featureFlagged := make(map[string]bool) |
| 110 | |
| 111 | // get_label is intentionally in both issues and labels toolsets for conformance |
| 112 | // with original behavior where it was registered in both |
| 113 | allowedDuplicates := map[string]bool{ |
| 114 | "get_label": true, |
| 115 | } |
| 116 | |
| 117 | // First pass: identify tools that have feature flags (mutually exclusive at runtime) |
| 118 | for _, tool := range tools { |
| 119 | if tool.FeatureFlagEnable != "" || len(tool.FeatureFlagDisable) > 0 { |
| 120 | featureFlagged[tool.Tool.Name] = true |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | for _, tool := range tools { |
| 125 | name := tool.Tool.Name |
| 126 | // Allow duplicates for explicitly allowed tools and feature-flagged tools |
| 127 | if !allowedDuplicates[name] && !featureFlagged[name] { |
| 128 | assert.False(t, seen[name], |
| 129 | "Duplicate tool name found: %q", name) |
| 130 | } |
| 131 | seen[name] = true |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | // TestNoDuplicateResourceNames ensures all resources have unique names |
| 136 | func TestNoDuplicateResourceNames(t *testing.T) { |
nothing calls this directly
no test coverage detected