Skip to content

Commit 02697a2

Browse files
committed
feat: add framework function to check namespace
Signed-off-by: Luca Di Maio <[email protected]>
1 parent 49785a0 commit 02697a2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

e2e/framework/helper.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,21 @@ func ExpectEmpty(actual interface{}, explain ...interface{}) {
6262
gomega.ExpectWithOffset(1, actual).To(gomega.BeEmpty(), explain...)
6363
}
6464

65+
func ExpectNamespace(namespace string) {
66+
kubeClient, err := kube.NewKubeHelper()
67+
ExpectNoErrorWithOffset(1, err)
68+
69+
err = wait.PollImmediate(time.Second, time.Minute*2, func() (done bool, err error) {
70+
ns, err := kubeClient.Client().KubeClient().CoreV1().Namespaces().Get(context.TODO(), namespace, metav1.GetOptions{})
71+
if err != nil {
72+
return false, nil
73+
}
74+
75+
return ns.Name == namespace, nil
76+
})
77+
ExpectNoErrorWithOffset(1, err)
78+
}
79+
6580
func ExpectRemoteFileContents(imageSelector string, namespace string, filePath string, contents string) {
6681
kubeClient, err := kube.NewKubeHelper()
6782
ExpectNoErrorWithOffset(1, err)

0 commit comments

Comments
 (0)