From eb71ae43add2e1fa10d8223debde1660d5526419 Mon Sep 17 00:00:00 2001 From: SinghAman21 Date: Fri, 21 Aug 2026 11:50:55 +0530 Subject: [PATCH] test(action): cover forbidden namespace GET fallback in install tests Signed-off-by: SinghAman21 --- pkg/action/install_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/action/install_test.go b/pkg/action/install_test.go index 801372926..9249c1cab 100644 --- a/pkg/action/install_test.go +++ b/pkg/action/install_test.go @@ -293,6 +293,22 @@ func TestInstallCreateReleaseNamespaceNotFound(t *testing.T) { assert.Equal(t, 1, kubeClient.createCalls) } +func TestInstallCreateReleaseNamespaceForbidden(t *testing.T) { + config := actionConfigFixture(t) + kubeClient := &namespaceKubeClient{ + FailingKubeClient: kubefake.FailingKubeClient{ + PrintingKubeClient: kubefake.PrintingKubeClient{Out: io.Discard}, + }, + namespace: "spaced", + getStatus: http.StatusForbidden, + } + config.KubeClient = kubeClient + instAction := installActionWithConfig(config) + + require.NoError(t, instAction.createReleaseNamespace()) + assert.Equal(t, 1, kubeClient.createCalls) +} + func TestInstallReleaseWithTakeOwnership_ResourceNotOwned(t *testing.T) { // This test will test checking ownership of a resource // returned by the fake client. If the resource is not