Refactor integration E2E tests

* General cleanup of the integration tests Golang code. Move the
  `e2e.go` codebase into its own package and separate files.
* Reduce the overall log spam from the integration tests output.
* Add final GitHub workflow step that stops GARM server, and does the
  GitHub cleanup of any orphaned resources.
* Add `TODO` to implement cleanup of the orphaned GitHub webhooks.
  This is useful, if the uninstall of the webhooks failed.
* Add `TODO` for extra missing checks on the GitHub webhooks
  install / uninstall logic.

Signed-off-by: Ionut Balutoiu <ibalutoiu@cloudbasesolutions.com>
This commit is contained in:
Ionut Balutoiu 2023-08-24 14:32:37 +03:00
parent 789644c27f
commit 318bc52b57
15 changed files with 1473 additions and 1547 deletions

View file

@ -61,13 +61,9 @@ jobs:
run: |
set -o pipefail
set -o errexit
go run ./test/integration/e2e.go 2>&1 | tee /artifacts-logs/e2e.log
go run ./test/integration/main.go 2>&1 | tee /artifacts-logs/e2e.log
env:
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
GARM_USERNAME: admin
GARM_FULLNAME: Local GARM Admin
GARM_EMAIL: admin@example.com
GARM_NAME: local_garm
ORG_NAME: gsamfira
REPO_NAME: garm-testing
CREDENTIALS_NAME: test-garm-creds
@ -86,3 +82,18 @@ jobs:
with:
name: garm-logs
path: /artifacts-logs
- name: Cleanup orphan GARM resources via GitHub API
if: always()
run: |
set -o pipefail
set -o errexit
sudo systemctl stop garm
go run ./test/integration/gh_cleanup/main.go
env:
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
ORG_NAME: gsamfira
REPO_NAME: garm-testing
GH_TOKEN: ${{ secrets.GH_OAUTH_TOKEN }}