Skip to content

Commit

Permalink
Merge 91b2808 into 9c592c4
Browse files Browse the repository at this point in the history
  • Loading branch information
rm3l authored Mar 8, 2023
2 parents 9c592c4 + 91b2808 commit 2aca0a6
Showing 1 changed file with 43 additions and 5 deletions.
48 changes: 43 additions & 5 deletions tests/integration/cmd_describe_component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,36 @@ var _ = Describe("odo describe component command tests", func() {
})
}

It("should fail, with cluster", func() {
It("should fail, with default cluster mode", func() {
By("running odo describe component -o json with an unknown name", func() {
res := helper.Cmd("odo", "describe", "component", "--name", "unknown-name", "-o", "json").ShouldFail()
stdout, stderr := res.Out(), res.Err()
Expect(helper.IsJSON(stderr)).To(BeTrue())
Expect(stdout).To(BeEmpty())
helper.JsonPathContentContain(stderr, "message", "no component found with name \"unknown-name\" in the namespace \""+commonVar.Project+"\"")
helper.JsonPathContentContain(stderr, "message", "no component found with name \"unknown-name\"")
})

By("running odo describe component with an unknown name", func() {
res := helper.Cmd("odo", "describe", "component", "--name", "unknown-name").ShouldFail()
stdout, stderr := res.Out(), res.Err()
Expect(stdout).To(BeEmpty())
Expect(stderr).To(ContainSubstring("no component found with name \"unknown-name\""))
})
})

It("should fail, with cluster", func() {
By("running odo describe component -o json with an unknown name", func() {
res := helper.Cmd("odo", "describe", "component", "--name", "unknown-name", "--platform", "cluster", "-o", "json").ShouldFail()
stdout, stderr := res.Out(), res.Err()
Expect(helper.IsJSON(stderr)).To(BeTrue())
Expect(stdout).To(BeEmpty())
helper.JsonPathContentContain(stderr, "message", "no component found with name \"unknown-name\" in the namespace \""+commonVar.Project+"\"")
})

By("running odo describe component with an unknown name", func() {
res := helper.Cmd("odo", "describe", "component", "--name", "unknown-name", "--platform", "cluster").ShouldFail()
stdout, stderr := res.Out(), res.Err()
Expect(stdout).To(BeEmpty())
Expect(stderr).To(ContainSubstring("no component found with name \"unknown-name\" in the namespace \"" + commonVar.Project + "\""))
})
})
Expand Down Expand Up @@ -197,15 +214,15 @@ var _ = Describe("odo describe component command tests", func() {
})
}

It("should not describe the component from another directory", func() {
It("should not describe the component from another directory, with default cluster mode", func() {
By("running with json output", func() {
err := os.Chdir("/")
Expect(err).NotTo(HaveOccurred())
res := helper.Cmd("odo", "describe", "component", "--name", cmpName, "-o", "json").ShouldFail()
stdout, stderr := res.Out(), res.Err()
Expect(helper.IsJSON(stderr)).To(BeTrue())
Expect(stdout).To(BeEmpty())
helper.JsonPathContentContain(stderr, "message", "no component found with name \""+cmpName+"\" in the namespace \""+commonVar.Project+"\"")
helper.JsonPathContentContain(stderr, "message", "no component found with name \""+cmpName+"\"")
})

By("running with default output", func() {
Expand All @@ -214,7 +231,28 @@ var _ = Describe("odo describe component command tests", func() {
res := helper.Cmd("odo", "describe", "component", "--name", cmpName).ShouldFail()
stdout, stderr := res.Out(), res.Err()
Expect(stdout).To(BeEmpty())
Expect(stderr).To(ContainSubstring("no component found with name \"" + cmpName + "\" in the namespace \"" + commonVar.Project + "\""))
Expect(stderr).To(ContainSubstring("no component found with name %q", cmpName))
})
})

It("should not describe the component from another directory, with cluster", func() {
By("running with json output", func() {
err := os.Chdir("/")
Expect(err).NotTo(HaveOccurred())
res := helper.Cmd("odo", "describe", "component", "--name", cmpName, "-o", "json", "--platform", "cluster").ShouldFail()
stdout, stderr := res.Out(), res.Err()
Expect(helper.IsJSON(stderr)).To(BeTrue())
Expect(stdout).To(BeEmpty())
helper.JsonPathContentContain(stderr, "message", "no component found with name \""+cmpName+"\" in the namespace \""+commonVar.Project+"\"")
})

By("running with default output", func() {
err := os.Chdir("/")
Expect(err).NotTo(HaveOccurred())
res := helper.Cmd("odo", "describe", "component", "--name", cmpName, "--platform", "cluster").ShouldFail()
stdout, stderr := res.Out(), res.Err()
Expect(stdout).To(BeEmpty())
Expect(stderr).To(ContainSubstring("no component found with name %q in the namespace %q", cmpName, commonVar.Project))
})
})

Expand Down

0 comments on commit 2aca0a6

Please sign in to comment.