Skip to content

Commit

Permalink
consolidated some integration tests (redhat-developer#3835)
Browse files Browse the repository at this point in the history
* consolidated some integration tests

* used better spec titles

* added cmpName in the push

* Added other spec

* reverted the consolidation
  • Loading branch information
girishramnani authored Aug 27, 2020
1 parent 55c074e commit 1dfc312
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions tests/integration/devfile/cmd_devfile_test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,22 @@ var _ = Describe("odo devfile test command tests", func() {

Context("Should show proper errors", func() {

It("should show error if component is not pushed", func() {
// used ";" as consolidating symbol as this spec covers multiple scenerios
It("should show error if component is not pushed; should error out if a non-existent command or a command from wrong group is specified", func() {
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)

helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-testgroup.yaml"), filepath.Join(context, "devfile.yaml"))

output := helper.CmdShouldFail("odo", "test", "--context", context)

Expect(output).To(ContainSubstring("error occurred while getting the pod: pod not found for the selector"))

helper.CmdShouldPass("odo", "push", "--context", context)
output = helper.CmdShouldFail("odo", "test", "--test-command", "invalidcmd", "--context", context)
Expect(output).To(ContainSubstring("not found in the devfile"))

output = helper.CmdShouldFail("odo", "test", "--test-command", "devrun", "--context", context)
Expect(output).To(ContainSubstring("command devrun is of group run in devfile.yaml"))
})

It("should show error if no test group is defined", func() {
Expand All @@ -66,28 +73,6 @@ var _ = Describe("odo devfile test command tests", func() {
Expect(output).To(ContainSubstring("the command group of kind \"test\" is not found in the devfile"))
})

It("should show error if specify non-exist command", func() {
helper.CmdShouldPass("odo", "create", "nodejs", "--context", context, cmpName)

helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-testgroup.yaml"), filepath.Join(context, "devfile.yaml"))
helper.CmdShouldPass("odo", "push", "--context", context)
output := helper.CmdShouldFail("odo", "test", "--test-command", "invalidcmd", "--context", context)

Expect(output).To(ContainSubstring("not found in the devfile"))
})

It("should show error if command from another group", func() {
helper.CmdShouldPass("odo", "create", "nodejs", "--context", context, cmpName)

helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-testgroup.yaml"), filepath.Join(context, "devfile.yaml"))
helper.CmdShouldPass("odo", "push", "--context", context)
output := helper.CmdShouldFail("odo", "test", "--test-command", "devrun", "--context", context)

Expect(output).To(ContainSubstring("command devrun is of group run in devfile.yaml"))
})

It("should show error if devfile has no default test command", func() {
helper.CmdShouldPass("odo", "create", "nodejs", "--context", context, cmpName)
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
Expand Down

0 comments on commit 1dfc312

Please sign in to comment.