Skip to content

Commit

Permalink
Restructure 'set namespace' tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rm3l committed May 16, 2022
1 parent 6c49ab1 commit 6afaa5c
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/integration/cmd_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,19 @@ var _ = Describe("odo create/delete/list/set namespace/project tests", func() {
}
})

It("should set again the " + commandName, func() {
helper.Cmd("odo", "set", commandName, commonVar.Project).ShouldPass()
Expect(commonVar.CliRunner.GetActiveNamespace()).Should(Equal(commonVar.Project))
})
It("should successfully set the "+commandName, func() {
anotherNs := "my-fake-ns-" + helper.RandString(3)

It(fmt.Sprintf("should set the %s even if it does not exist in the cluster", commandName), func() {
fakeNamespace := "my-fake-ns-" + helper.RandString(3)
Expect(commonVar.CliRunner.GetAllNamespaceProjects()).ShouldNot(ContainElement(fakeNamespace))
helper.Cmd("odo", "set", commandName, fakeNamespace).ShouldPass()
Expect(commonVar.CliRunner.GetActiveNamespace()).To(Equal(fakeNamespace))
By(fmt.Sprintf("setting it to a valid %s", commandName), func() {
Expect(commonVar.CliRunner.GetActiveNamespace()).ShouldNot(Equal(anotherNs))
helper.Cmd("odo", "set", commandName, anotherNs).ShouldPass()
Expect(commonVar.CliRunner.GetActiveNamespace()).To(Equal(anotherNs))
})

By("setting it again to its previous value", func() {
helper.Cmd("odo", "set", commandName, anotherNs).ShouldPass()
Expect(commonVar.CliRunner.GetActiveNamespace()).To(Equal(anotherNs))
})
})

It(fmt.Sprintf("should not succeed to set the %s", commandName), func() {
Expand Down

0 comments on commit 6afaa5c

Please sign in to comment.