Skip to content

Commit

Permalink
Updated component test
Browse files Browse the repository at this point in the history
  • Loading branch information
amitkrout committed Jun 13, 2019
1 parent 300d765 commit 71c789b
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions tests/integration/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ func componentTests(args ...string) {
Expect(cmpList).To(ContainSubstring("cmp-git"))
helper.CmdShouldPass("odo", append(args, "delete", "cmp-git", "-f")...)
})

It("creates and pushes local nodejs component and then deletes --all", func() {
helper.CopyExample(filepath.Join("source", "nodejs"), context)
helper.CmdShouldPass("odo", append(args, "create", "nodejs", "--project", project, "--env", "key=value,key1=value1")...)
helper.CmdShouldPass("odo", append(args, "push")...)
helper.CmdShouldPass("odo", append(args, "delete", "--all", "-f")...)

})
})

Context("Test odo push with --source and --config flags", func() {
Expand Down Expand Up @@ -260,12 +252,14 @@ func componentTests(args ...string) {

JustBeforeEach(func() {
context = helper.CreateNewContext()
project = helper.CreateRandProject()
originalDir = helper.Getwd()
helper.Chdir(context)
})

JustAfterEach(func() {
helper.Chdir(originalDir)
helper.DeleteProject(project)
os.RemoveAll(context)
})

Expand Down Expand Up @@ -369,7 +363,6 @@ func componentTests(args ...string) {
cmpName := "nodejs"

JustBeforeEach(func() {
SetDefaultEventuallyTimeout(10 * time.Minute)
project = helper.CreateRandProject()
context = helper.CreateNewContext()
originalDir = helper.Getwd()
Expand Down Expand Up @@ -401,21 +394,21 @@ func componentTests(args ...string) {
helper.CmdShouldPass("odo", "push", "--context", context)

// list command should fail as no app flag is given
helper.CmdShouldFail("odo", "list")
helper.CmdShouldFail("odo", "list", "--project", project)
// commands should fail as the component name is missing
helper.CmdShouldFail("odo", "describe", "--app", appName)
helper.CmdShouldFail("odo", "delete", "-f", "--app", appName)
helper.CmdShouldFail("odo", "describe", "--app", appName, "--project", project)
helper.CmdShouldFail("odo", "delete", "-f", "--app", appName, "--project", project)
})

It("should pass outside a odo directory with component name as parameter", func() {
helper.CopyExample(filepath.Join("source", "nodejs"), context)
helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)
helper.CmdShouldPass("odo", "push", "--context", context)

cmpListOutput := helper.CmdShouldPass("odo", "list", "--app", appName)
cmpListOutput := helper.CmdShouldPass("odo", "list", "--app", appName, "--project", project)
Expect(cmpListOutput).To(ContainSubstring(cmpName))
helper.CmdShouldPass("odo", "describe", cmpName, "--app", appName)
helper.CmdShouldPass("odo", "delete", cmpName, "--app", appName, "-f")
helper.CmdShouldPass("odo", "describe", cmpName, "--app", appName, "--project", project)
helper.CmdShouldPass("odo", "delete", cmpName, "--app", appName, "--project", project, "-f")
})
})
}

0 comments on commit 71c789b

Please sign in to comment.