From 41951a624e2f2644de49345a59bc40c69a7ee01a Mon Sep 17 00:00:00 2001 From: donal <donalspring@gmail.com> Date: Wed, 25 Apr 2018 12:36:22 +0200 Subject: [PATCH] FIX - missing mongodb steps from test --- exercises/3-revenge-of-the-automated-testing/README.md | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/exercises/3-revenge-of-the-automated-testing/README.md b/exercises/3-revenge-of-the-automated-testing/README.md index c0ec9e3..ef669f5 100644 --- a/exercises/3-revenge-of-the-automated-testing/README.md +++ b/exercises/3-revenge-of-the-automated-testing/README.md @@ -145,8 +145,39 @@ 2. Undo the changes you made to the `ListOfTodos.spec.js` file, commit your code and rerun the build. This should trigger a full `build --> bake --> deploy` of `todolist-fe`. -2. We're now going to do the same for the api. Head to the `configure` panel of the `dev-todolist-api-build` job. +2. We're now going to do the same for the api. However, in order to run our API tests in CI; we need there to be a MongoDB available for testing. In our `enablement-ci-cd` repo; checkout the mongo branch as shown below to bring in the template and params. The mongodb template we're using is the same as the one for our `todolist-fe` created in previous lab. +```bash +$ git checkout exercise3/mongodb params/mongodb templates/mongodb.yml +``` +2. Open `enablement-ci-cd` in your favourite editor. Edit the `inventory/host_vars/ci-cd-tooling.yml` to include a new object for our mongodb as shown below. This item can be added below the jenkins slave in the `ci-cd-builds` section. +```yaml + - name: "jenkins-mongodb" + namespace: "{{ ci_cd_namespace }}" + template: "{{ playbook_dir }}/templates/mongodb.yml" + params: "{{ playbook_dir }}/params/mongodb" + tags: + - mongodb +``` +![jenkins-mongo](../images/exercise3/jenkins-mongo.png) + +2. Git commit your updates to the inventory to git for traceability. +```bash +$ git add . +$ git commit -m "ADD - mongodb for use in the pipeline" +$ git push +``` + +2. Apply this change as done previously using ansible. The deployment can be validated by going to your `<YOUR_NAME>-ci-cd` namespace! +```bash +$ ansible-playbook apply.yml -e target=tools \ + -i inventory/ \ + -e "filter_tags=mongodb" +``` +![ocp-mongo](../images/exercise3/ocp-mongo.png) + +2. With the mongodb in place Open up Jenkins and head to the `configure` panel of the `dev-todolist-api-build` job. + 2. Add `npm run test:ci` above `npm run build:ci`. ![api-build-step](../images/exercise3/api-build-step.png) -- Gitblit v1.9.3