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

Deploy delete tests #10

Merged
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
2 changes: 1 addition & 1 deletion tests/examples/source/devfilesV2/nodejs/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schemaVersion: "2.0.0"
metadata:
name: test-devfile
dockerfile: "https://raw.githubusercontent.com/neeraj-laad/nodejs-stack-registry/build-deploy/devfiles/nodejs-basic/build/Dockerfile"
deployment-manifest: "https://raw.githubusercontent.com/groeges/devfile-registry/master/devfiles/nodejs/deploy.yaml"
deployment-manifest: "https://raw.githubusercontent.com/groeges/devfile-registry/master/devfiles/nodejs/deploy_deployment.yaml"
projects:
- name: nodejs-web-app
git:
Expand Down
25 changes: 22 additions & 3 deletions tests/integration/devfile/cmd_devfile_deploy_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var _ = Describe("odo devfile deploy delete command tests", func() {

helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
helper.CopyExampleDevFile(filepath.Join("source", "devfilesV2", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))

output := helper.CmdShouldFail("odo", "deploy", "delete")
expectedString := "stat .odo/manifest.yaml: no such file or directory"
Expand All @@ -65,13 +65,32 @@ var _ = Describe("odo devfile deploy delete command tests", func() {

helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile_deploy.yaml"), filepath.Join(context, "devfile.yaml"))
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "manifest.yaml"), filepath.Join(context, ".odo", "manifest.yaml"))
helper.CopyExampleDevFile(filepath.Join("source", "devfilesV2", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
helper.CopyExampleDevFile(filepath.Join("source", "devfilesV2", "nodejs", "manifest.yaml"), filepath.Join(context, ".odo", "manifest.yaml"))

output := helper.CmdShouldFail("odo", "deploy", "delete")
expectedString := "Could not delete deployment nodejs-deploy as deployment was not found"

helper.MatchAllInOutput(output, []string{expectedString})
Expect(helper.VerifyFileExists(filepath.Join(context, ".odo", "manifest.yaml"))).To(Equal(false))
})

})

Context("when manifest.yaml is present, and deployment exists", func() {
It("should pass, by deleting the manifest.yaml, and deleting deployment in cluster", func() {

helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
helper.CopyExampleDevFile(filepath.Join("source", "devfilesV2", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
helper.CmdShouldPass("odo", "url", "create", "--port", "3000")
helper.CmdShouldPass("odo", "deploy", "--tag", "image-registry.openshift-image-registry.svc:5000/"+namespace+"/my-nodejs:1.0", "--devfile", "devfile.yaml")

helper.CmdShouldPass("odo", "deploy", "delete")
cliRunner.WaitAndCheckForExistence("deployments", namespace, 1)
cliRunner.WaitAndCheckForExistence("services", namespace, 1)
cliRunner.WaitAndCheckForExistence("routes", namespace, 1)
Expect(helper.VerifyFileExists(filepath.Join(context, ".odo", "manifest.yaml"))).To(Equal(false))
})

})
Expand Down