From 94e2e549ea84ad3ef796e7afd0aca28363a27930 Mon Sep 17 00:00:00 2001 From: Nick Neisen Date: Wed, 8 Nov 2023 09:37:21 -0700 Subject: [PATCH] Add integration tests --- .github/workflows/Merge.yml | 3 ++- .github/workflows/Release.yml | 5 +++-- .github/workflows/e2e.yml | 33 +++++++++++++++++++++++++++++++++ docs/CI.md | 3 --- test/README.md | 1 + test/bop_test.go | 11 +++++++++++ 6 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/e2e.yml create mode 100644 test/README.md create mode 100644 test/bop_test.go diff --git a/.github/workflows/Merge.yml b/.github/workflows/Merge.yml index 293c073e..edb050fb 100644 --- a/.github/workflows/Merge.yml +++ b/.github/workflows/Merge.yml @@ -10,9 +10,10 @@ jobs: uses: ./.github/workflows/vet.yml unit-test: uses: ./.github/workflows/unit.yml + e2e: + uses: ./.github/workflows/e2e.yml build: uses: ./.github/workflows/build.yml - # TODO add integration tests push-to-ghcr: if: ${{ always() && contains(join(needs.*.result, ','), 'success') }} # if all `needs` jobs are successful needs: [vet, unit-test, build] diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index e1657c06..89a5d769 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -8,10 +8,11 @@ jobs: vet: uses: ./.github/workflows/vet.yml unit-test: - uses: ./.github/workflows/unit.yml + uses: ./.github/workflows/unit.yml + e2e: + uses: ./.github/workflows/e2e.yml build: uses: ./.github/workflows/build.yml - # TODO add integration tests push-to-ghcr: if: ${{ always() && contains(join(needs.*.result, ','), 'success') }} # if all `needs` jobs are successful needs: [vet, unit-test, build] diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 00000000..d2af8014 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,33 @@ +name: e2e + +on: + workflow_call: + +jobs: + e2e: + name: e2e + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Load environment + uses: c-py/action-dotenv-to-setenv@v4 + with: + env-file: .github/development.env + + - name: Setup Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Create kind cluster + uses: helm/kind-action@v1.8.0 + with: + cluster_name: bctl-e2e-cluster + node_image: ${{ env.KIND_CLUSTER_VERSION }} + + - name: Run E2E tests + run: go test ./test -v diff --git a/docs/CI.md b/docs/CI.md index cdc26c87..5e83d390 100644 --- a/docs/CI.md +++ b/docs/CI.md @@ -14,9 +14,6 @@ CI for a PR will trigger whenever a PR is opened, reopened, or pushed. The jobs Merging to main runs many of the same tests as a PR to verify that merging the code didn't introduce any new issues. Merging will also run integration tests to verify that the code works with the rest of the system as these tests require more setup and take longer to run. After all of the steps successfully run, the same image will be pushed with the commit `sha` and `dev` tags. -TODO: code coverage -TODO: If you merge a change into main and an issue is found, you will be notified on slack that you have broken main and need to fix it. - ## Releases A release is triggered when a pre-release is created in the github repo. This will run EVERYTHING from scratch. Starting from zero may take more time but this ensures that nothing slips by us before sending out the release. This includes any static code analysis, unit tests, integration tests, and building the binaries. If everything passes, the same image will pushed with `latest`, `sha`, `semver`, and `dev` tags. This process is documented in [Creating a release](docs/creating-a-release.md). diff --git a/test/README.md b/test/README.md new file mode 100644 index 00000000..84566a8e --- /dev/null +++ b/test/README.md @@ -0,0 +1 @@ +# E2E Tests diff --git a/test/bop_test.go b/test/bop_test.go new file mode 100644 index 00000000..917eb62a --- /dev/null +++ b/test/bop_test.go @@ -0,0 +1,11 @@ +package test + +import ( + "fmt" + "testing" +) + +func TestBCTL(t *testing.T) { + fmt.Println("Running bop end-to-end tests") + fmt.Println("Finished bop end-to-end tests") +}