diff --git a/tests/helper/helper_cli.go b/tests/helper/helper_cli.go index 7992802470a..bb89f58118d 100644 --- a/tests/helper/helper_cli.go +++ b/tests/helper/helper_cli.go @@ -26,6 +26,7 @@ type CliRunner interface { // HasNamespaceProject returns whether the specified namespace or project exists in the cluster HasNamespaceProject(name string) bool + ListNamespaceProject(name string) GetActiveNamespace() string GetEnvsDevFileDeployment(componentName, appName, projectName string) map[string]string diff --git a/tests/helper/helper_kubectl.go b/tests/helper/helper_kubectl.go index d6bef4f1405..e144252232d 100644 --- a/tests/helper/helper_kubectl.go +++ b/tests/helper/helper_kubectl.go @@ -390,6 +390,12 @@ func (kubectl KubectlRunner) HasNamespaceProject(name string) bool { return strings.Contains(out, name) } +func (kubectl KubectlRunner) ListNamespaceProject(name string) { + Eventually(func() string { + return Cmd(kubectl.path, "get", "ns").ShouldRun().Out() + }, 30, 5).Should(ContainSubstring(name)) +} + func (kubectl KubectlRunner) GetActiveNamespace() string { return Cmd(kubectl.path, "config", "view", "--minify", "-ojsonpath={..namespace}").ShouldPass().Out() } diff --git a/tests/helper/helper_oc.go b/tests/helper/helper_oc.go index 091658c48ef..937b93d66dc 100644 --- a/tests/helper/helper_oc.go +++ b/tests/helper/helper_oc.go @@ -582,6 +582,12 @@ func (oc OcRunner) HasNamespaceProject(name string) bool { return strings.Contains(out, name) } +func (oc OcRunner) ListNamespaceProject(name string) { + Eventually(func() string { + return Cmd(oc.path, "get", "project").ShouldRun().Out() + }, 30, 5).Should(ContainSubstring(name)) +} + func (oc OcRunner) GetActiveNamespace() string { return Cmd(oc.path, "config", "view", "--minify", "-ojsonpath={..namespace}").ShouldPass().Out() } diff --git a/tests/integration/interactive_add_binding_test.go b/tests/integration/interactive_add_binding_test.go index 79a8ad9b2e9..9e602b110a6 100644 --- a/tests/integration/interactive_add_binding_test.go +++ b/tests/integration/interactive_add_binding_test.go @@ -226,8 +226,8 @@ var _ = Describe("odo add binding interactive command tests", func() { helper.GetExamplePath("manifests", "bindablekind-instance.yaml")) Expect(addBindableKindInOtherNs.ExitCode()).To(BeEquivalentTo(0)) nsWithNoService = commonVar.CliRunner.CreateAndSetRandNamespaceProject() - Expect(commonVar.CliRunner.HasNamespaceProject(nsWithNoService)).Should(Equal(true)) - Expect(commonVar.CliRunner.HasNamespaceProject(otherNS)).Should(Equal(true)) + commonVar.CliRunner.ListNamespaceProject(nsWithNoService) + commonVar.CliRunner.ListNamespaceProject(otherNS) commonVar.CliRunner.SetProject(commonVar.Project) }) @@ -558,8 +558,8 @@ var _ = Describe("odo add binding interactive command tests", func() { helper.GetExamplePath("manifests", "bindablekind-instance.yaml")) Expect(addBindableKindInOtherNs.ExitCode()).To(BeEquivalentTo(0)) nsWithNoService = commonVar.CliRunner.CreateAndSetRandNamespaceProject() - Expect(commonVar.CliRunner.HasNamespaceProject(nsWithNoService)).Should(Equal(true)) - Expect(commonVar.CliRunner.HasNamespaceProject(otherNS)).Should(Equal(true)) + commonVar.CliRunner.ListNamespaceProject(nsWithNoService) + commonVar.CliRunner.ListNamespaceProject(otherNS) commonVar.CliRunner.SetProject(commonVar.Project) })