Skip to content

Commit

Permalink
Run devfile create Interation test on kubernetes cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
prietyc123 committed May 8, 2020
1 parent 5996a4c commit 326209b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
# Run devfile integration test on Kubernetes cluster
- <<: *base-test
stage: test
name: "devfile catalog and watch command integration tests on kubernetes cluster"
name: "devfile catalog, watch and create command integration tests on kubernetes cluster"
before_script:
# Download kubectl, a cli tool for accessing Kubernetes cluster
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
Expand All @@ -189,3 +189,6 @@ jobs:
- export KUBERNETES=true
- travis_wait make test-cmd-devfile-catalog
- travis_wait make test-cmd-devfile-watch
- travis_wait make test-cmd-devfile-create


18 changes: 13 additions & 5 deletions tests/integration/devfile/cmd_devfile_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,25 @@ var _ = Describe("odo devfile create command tests", func() {
// This is run after every Spec (It)
var _ = BeforeEach(func() {
SetDefaultEventuallyTimeout(10 * time.Minute)
namespace = helper.CreateRandProject()
context = helper.CreateNewContext()
currentWorkingDirectory = helper.Getwd()
helper.Chdir(context)
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true")
if os.Getenv("KUBERNETES") == "true" {
namespace = helper.CreateRandNamespace(context)
} else {
namespace = helper.CreateRandProject()
}
currentWorkingDirectory = helper.Getwd()
helper.Chdir(context)
})

// This is run after every Spec (It)
var _ = AfterEach(func() {
helper.DeleteProject(namespace)
if os.Getenv("KUBERNETES") == "true" {
helper.DeleteNamespace(namespace)
} else {
helper.DeleteProject(namespace)
}
helper.Chdir(currentWorkingDirectory)
helper.DeleteDir(context)
os.Unsetenv("GLOBALODOCONFIG")
Expand Down Expand Up @@ -122,7 +130,7 @@ var _ = Describe("odo devfile create command tests", func() {
Context("When executing odo create with an invalid devfile component", func() {
It("should fail with please run 'odo catalog list components'", func() {
fakeComponentName := "fake-component"
output := helper.CmdShouldFail("odo", "create", fakeComponentName)
output := helper.CmdShouldFail("odo", "create", fakeComponentName, "-v4")
expectedString := "\"" + fakeComponentName + "\" not found"
helper.MatchAllInOutput(output, []string{expectedString})
})
Expand Down

0 comments on commit 326209b

Please sign in to comment.