Skip to content

Commit

Permalink
updated manifest file and added tests (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronMcWilliam authored Jun 30, 2020
1 parent 1e2c221 commit 1d1423b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
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

0 comments on commit 1d1423b

Please sign in to comment.