Test refactoring, incorporate feedback from reviews
@@ -24,13 +24,13 @@ var _ = Describe("odo devfile log command tests", func() {
helper.CommonAfterEach(commonVar)
})
- Context("Verify odo log for devfile works", func() {
-
- It("should log run command output and fail for debug command", func() {
-
+ When("When a springboot component is created and pushed", func() {
+ BeforeEach(func() {
helper.Cmd("odo", "create", "--project", commonVar.Project, cmpName, "--context", commonVar.Context, "--devfile", helper.GetExamplePath("source", "devfiles", "springboot", "devfile.yaml")).ShouldPass()
helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), commonVar.Context)
helper.Cmd("odo", "push", "--context", commonVar.Context).ShouldPass()
+ })
+ It("should log run command output and fail for debug command", func() {
output := helper.Cmd("odo", "log", "--context", commonVar.Context).ShouldPass().Out()
Expect(output).To(ContainSubstring("ODO_COMMAND_RUN"))
@@ -38,37 +38,42 @@ var _ = Describe("odo devfile log command tests", func() {
helper.Cmd("odo", "log", "--debug").ShouldFail()
/*
- Flaky Test odo log -f, see issue https://github.com/redhat-developer/odo/issues/3809
+ Flaky Test odo log -f, see issue https://github.com/redhat-developer/odo/issues/3809 *** Issue got closed due to inactivity, but is not resolved ***
match, err := helper.RunCmdWithMatchOutputFromBuffer(30*time.Second, "program=devrun", "odo", "log", "-f")
Expect(err).To(BeNil())
Expect(match).To(BeTrue())
*/
})
+ })
- It("should error out if component does not exist", func() {
+ When("a component is created but not pushed", func() {
+ BeforeEach(func() {
helper.Cmd("odo", "create", "--project", commonVar.Project, cmpName, "--context", commonVar.Context, "--devfile", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-registry.yaml")).ShouldPass()
+ })
+ It("Should error out", func() {
helper.Cmd("odo", "log").ShouldFail()
})
-
- It("should log debug command output", func() {
- projectDir := filepath.Join(commonVar.Context, "projectDir")
+ When("a command is created and pushed with debugrun", func() {
+ var projectDir string
+ BeforeEach(func() {
+ projectDir = filepath.Join(commonVar.Context, "projectDir")
helper.CopyExample(filepath.Join("source", "web-nodejs-sample"), projectDir)
helper.Cmd("odo", "create", "--project", commonVar.Project, cmpName, "--context", projectDir, "--devfile", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-debugrun.yaml")).ShouldPass()
helper.Cmd("odo", "push", "--debug", "--context", projectDir).ShouldPass()
-
+ })
+ It("should log debug command output", func() {
output := helper.Cmd("odo", "log", "--debug", "--context", projectDir).ShouldPass().Out()
Expect(output).To(ContainSubstring("ODO_COMMAND_DEBUG"))
/*
- Flaky Test odo log -f, see issue https://github.com/redhat-developer/odo/issues/3809
+ Flaky Test odo log -f, see issue https://github.com/redhat-developer/odo/issues/3809 *** Issue got closed due to inactivity, but is not resolved ***
match, err := helper.RunCmdWithMatchOutputFromBuffer(30*time.Second, "program=debugrun", "odo", "log", "-f")
Expect(err).To(BeNil())
Expect(match).To(BeTrue())
*/
-
})
-
})
})
+})
