From 326209b1a6e0c441d5408117671fdd0749114feb Mon Sep 17 00:00:00 2001 From: Priti Kumari Date: Wed, 15 Apr 2020 13:14:25 +0530 Subject: [PATCH] Run devfile create Interation test on kubernetes cluster --- .travis.yml | 5 ++++- .../devfile/cmd_devfile_create_test.go | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 50d0a736f80..7d8f54b4752 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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/ @@ -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 + + diff --git a/tests/integration/devfile/cmd_devfile_create_test.go b/tests/integration/devfile/cmd_devfile_create_test.go index e9e58702a59..4271a7153f9 100644 --- a/tests/integration/devfile/cmd_devfile_create_test.go +++ b/tests/integration/devfile/cmd_devfile_create_test.go @@ -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") @@ -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}) })