Skip to main content

Repository: govuk-synthetic-test-app

Synthetic test app used to run Ginkgo tests to test aspects of the GOV.UK infrastructure

Ownership
#govuk-platform-engineering-team owns the repo. #govuk-platform-support receives automated alerts for this repo.
Category
Utilities

README

This is a synthetic test app used to run Ginkgo tests to test the deployment pipeline for the GOV.UK infrastructure.

The tests run in production and assumes roles in lower environments so we trace every aspect of a deployment from merge to production.

The app being tracked in the tests is the https://github.com/alphagov/govuk-synthetic-test-app-canary.

[!NOTE] The tests take ~ 15 mins to complete and the primary tests are called from helpers/pipeline_test.go

The tests cover:

  • pushing a change and version bump to the govuk-synthetic-test-app-canary
  • watching the release and deploy github actions that bump the version in integration.

Per env flow:

  • watching argo cd rollout the new version
  • watching the argo workflows run successfully and trigger the deploy in the next environment
  • checking govuk-helm-charts contains the updated version
  • checking argo cd application is synced and healthy
  • checking the pods are running the correct tag and container sha (pulled from ghcr)
  • verify the app is reporting the correct version on an endpoint
  • pushing the status of the test to metrics in production that are prefixed with environment
  • repeat for the next env until production

Deploying the tests on EKS

To deploy the tests you will need to merge in your changes to the main branch and then update the image tag in the govuk-helm-charts repo to the latest release.

NOTE - the image will not appear in ECR until the image_tag is updated in govuk-helm-charts and the synthetic test cronjob pulls the image when it runs.

Running Ginkgo tests locally

[!CAUTION] The tests only work when deployed to the production EKS cluster as it is using the synthetic-test-assumer role to assume roles to query the state of the app in the lower environments

The tests are designed to run in production, there is no purely local way to run them, also there is no way to run them in github actions, unless we stored long lived credentials there. Your best bet when testing is to use scripts/test_img.sh to test your changes before committing them.

The image tag in the manifest is the most recent build generated by a merge into main or a manual trigger of the build-runner workflow in github actions.

This cmd will build and push your local changes to ghcr and deploy the pod in production from the newly built image:

./scripts/test_img.sh

Trail the logs of the pod to see the tests run.

kubectl logs govuk-synthetic-test-app-runner -n apps --follow
  • To delete the pod after the tests have completed run this kubectl command

gds aws govuk-production-platformengineer -- kubectl delete -f ./govuk-synthetic-test-app.yaml -n apps

Release

Once you’re happy with the tests, commit to main. Github action will automatically create a release and then lastly you’ll need to update helms-chart