Skip to content

Commit

Permalink
Add integration tests (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwneisen authored Nov 8, 2023
1 parent 9147e4c commit f40ec4e
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/Merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
cluster_name: bctl-e2e-cluster
node_image: ${{ env.KIND_CLUSTER_VERSION }}

- name: Run E2E tests
run: go test ./test -v
3 changes: 0 additions & 3 deletions docs/CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
1 change: 1 addition & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# E2E Tests
11 changes: 11 additions & 0 deletions test/bop_test.go
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit f40ec4e

Please sign in to comment.