Skip to content

Commit 7d7c97b

Browse files
committed
namespace test
1 parent 3e32a81 commit 7d7c97b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pkg/cmd/services_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,27 @@ func TestServicesCmd_DeleteServiceInstanceCmd(t *testing.T) {
130130
Flags: []string{"--namespace=test", "-o=json"},
131131
Args: []string{"someid"},
132132
},
133+
{
134+
Name: "test error on missing namespace",
135+
SvcCatalogClient: func() versioned.Interface {
136+
fake := &scFake.Clientset{}
137+
return fake
138+
},
139+
K8Client: func() kubernetes.Interface {
140+
return &kFake.Clientset{}
141+
},
142+
ExpectError: true,
143+
ValidateErr: func(t *testing.T, err error) {
144+
if err == nil {
145+
t.Fatalf("expected an error but didn't got one")
146+
}
147+
if err.Error() != "failed to get namespace: no namespace present. Cannot continue. Please set the --namespace flag or the KUBECTL_PLUGINS_CURRENT_NAMESPACE env var" {
148+
t.Fatalf("Expected error 'failed to get namespace: no namespace present. Cannot continue. Please set the --namespace flag or the KUBECTL_PLUGINS_CURRENT_NAMESPACE env var' but got %v", err)
149+
}
150+
},
151+
Flags: []string{"-o=json"},
152+
Args: []string{"someid"},
153+
},
133154
}
134155

135156
for _, tc := range cases {

0 commit comments

Comments
 (0)