chore: remove remaining references to singular namespace (#114208)

This commit is contained in:
Charandas
2025-11-20 11:23:36 +01:00
committed by GitHub
parent 5d26bc5ee1
commit 3c0d5745fe
3 changed files with 7 additions and 7 deletions
@@ -28,20 +28,20 @@ func Test_WithPathRewriters(t *testing.T) {
handler := WithPathRewriters(mockHandler, rewriters)
t.Run("should rewrite path", func(t *testing.T) {
req, err := http.NewRequest("GET", "/apis/scope.grafana.app/namespaces/stack-1234/query/blah", nil)
req, err := http.NewRequest("GET", "/apis/scope.grafana.app/namespaces/stacks-1234/query/blah", nil)
assert.NoError(t, err)
rr := httptest.NewRecorder()
handler.ServeHTTP(rr, req)
assert.Equal(t, http.StatusOK, rr.Code)
assert.Equal(t, "/apis/scope.grafana.app/namespaces/stack-1234/query", rr.Body.String())
assert.Equal(t, "/apis/scope.grafana.app/namespaces/stacks-1234/query", rr.Body.String())
})
t.Run("should ignore requests that don't match", func(t *testing.T) {
req, err := http.NewRequest("GET", "/apis/scope.grafana.app/namespaces/stack-1234/scopes/1", nil)
req, err := http.NewRequest("GET", "/apis/scope.grafana.app/namespaces/stacks-1234/scopes/1", nil)
assert.NoError(t, err)
rr := httptest.NewRecorder()
handler.ServeHTTP(rr, req)
assert.Equal(t, http.StatusOK, rr.Code)
assert.Equal(t, "/apis/scope.grafana.app/namespaces/stack-1234/scopes/1", rr.Body.String())
assert.Equal(t, "/apis/scope.grafana.app/namespaces/stacks-1234/scopes/1", rr.Body.String())
})
}
@@ -536,7 +536,7 @@ func TestCheckResourceOwnership(t *testing.T) {
"name": "test-resource",
"annotations": map[string]interface{}{
utils.AnnoKeyManagerKind: "terraform",
utils.AnnoKeyManagerIdentity: "tf-stack-1",
utils.AnnoKeyManagerIdentity: "tf-stacks-1",
},
},
},
@@ -546,7 +546,7 @@ func TestCheckResourceOwnership(t *testing.T) {
Identity: "repo-1",
},
expectError: true,
expectedMessage: "resource 'test-resource' is managed by terraform 'tf-stack-1' and cannot be modified by repo 'repo-1'",
expectedMessage: "resource 'test-resource' is managed by terraform 'tf-stacks-1' and cannot be modified by repo 'repo-1'",
},
}
@@ -26,7 +26,7 @@ func TestNamespaceMapper(t *testing.T) {
orgId: 123,
expected: "org-123",
},
// an invalid use-case, but just documenting that it's handled as stack-0
// an invalid use-case, but just documenting that it's handled as stacks-0
// this currently prevents the need to have the Mapper return (mapped, err) instead of just mapped.
// err checking is avoided for now to keep the usage fluent
{