Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential issue with odo describe component integration tests when Podman is installed #6642

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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\"")
rm3l marked this conversation as resolved.
Show resolved Hide resolved
})

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