Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devfile create Interation test on kubernetes cluster using travis CI #2884

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jobs:
# Run devfile integration test on Kubernetes cluster
- <<: *base-test
stage: test
name: "devfile catalog, watch, push and delete command integration tests on kubernetes cluster"
name: "devfile catalog, watch, push, delete and create command integration tests on kubernetes cluster"
env:
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
Expand All @@ -193,3 +193,4 @@ jobs:
- travis_wait make test-cmd-devfile-watch
- travis_wait make test-cmd-devfile-push
- travis_wait make test-cmd-devfile-delete
- travis_wait make test-cmd-devfile-create
34 changes: 25 additions & 9 deletions tests/integration/devfile/cmd_devfile_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,30 @@ import (
var _ = Describe("odo devfile create command tests", func() {
const devfile = "devfile.yaml"
const envFile = ".odo/env/env.yaml"
var namespace string
var context string
var currentWorkingDirectory string
var devfilePath string
var namespace, context, currentWorkingDirectory, devfilePath, originalKubeconfig string

// Using program commmand according to cliRunner in devfile
cliRunner := helper.GetCliRunner()

// 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")
originalKubeconfig = os.Getenv("KUBECONFIG")
helper.LocalKubeconfigSet(context)
namespace = cliRunner.CreateRandNamespaceProject()
currentWorkingDirectory = helper.Getwd()
helper.Chdir(context)
})

// This is run after every Spec (It)
var _ = AfterEach(func() {
helper.DeleteProject(namespace)
cliRunner.DeleteNamespaceProject(namespace)
helper.Chdir(currentWorkingDirectory)
err := os.Setenv("KUBECONFIG", originalKubeconfig)
Expect(err).NotTo(HaveOccurred())
helper.DeleteDir(context)
os.Unsetenv("GLOBALODOCONFIG")
})
Expand All @@ -48,7 +52,14 @@ var _ = Describe("odo devfile create command tests", func() {
Expect(helper.CmdShouldPass("odo", "create", "nodejs")).To(ContainSubstring(experimentalOutputMsg))

})
})

Context("Disabling experimental preference should show a disclaimer", func() {
JustBeforeEach(func() {
if os.Getenv("KUBERNETES") == "true" {
Skip("Skipping test because s2i image is not supported on Kubernetes cluster")
}
})
It("checks that the experimental warning does *not* appear when Experimental is set to false for create", func() {
helper.CmdShouldPass("odo", "preference", "set", "Experimental", "false", "-f")
helper.CopyExample(filepath.Join("source", "nodejs"), context)
Expand All @@ -67,7 +78,12 @@ var _ = Describe("odo devfile create command tests", func() {
It("should fail to create the devfile componet with invalid component type", func() {
fakeComponentName := "fake-component"
output := helper.CmdShouldFail("odo", "create", fakeComponentName)
expectedString := "component type \"" + fakeComponentName + "\" not found"
var expectedString string
if os.Getenv("KUBERNETES") == "true" {
expectedString = "component type not found"
} else {
expectedString = "component type \"" + fakeComponentName + "\" not found"
}
helper.MatchAllInOutput(output, []string{expectedString})
})
})
Expand Down