Skip to content

Commit

Permalink
Merge pull request #232 from replicatedhq/laverya/run-two-integration…
Browse files Browse the repository at this point in the history
…-tests

run integration tests both in a cluster job and on the CLI
  • Loading branch information
laverya authored Dec 21, 2023
2 parents c5b154c + fb79797 commit 3415cf3
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 4 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,31 @@ jobs:
run: make test

integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Build
run: make build

- name: Create k8s Kind Cluster
uses: helm/[email protected]

- name: Create Testdata in Cluster
run: ./testing/init.sh

- name: Run PVMigrate
run: ./bin/pvmigrate --source-sc int-source --dest-sc int-dest

- name: Validate Cluster End State
run: ./testing/validate.sh

integration-test-incluster:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,41 @@ jobs:
- name: Validate Cluster End State
run: ./testing/validate.sh

integration-test-incluster:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
file: testing/Dockerfile
tags: ttl.sh/build-test/pvmigrate:latest

- name: Create k8s Kind Cluster
uses: helm/[email protected]

- name: Create Testdata in Cluster
run: ./testing/init.sh

- name: Run PVMigrate
run: kubectl apply -f testing/yaml/migrate-job.yaml

- name: Validate Cluster End State
run: ./testing/validate.sh

goreleaser:
runs-on: ubuntu-latest
needs:
- unit-test
- integration-test
- integration-test-incluster
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
Expand Down
13 changes: 9 additions & 4 deletions testing/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ function spinner_until() {
done
}

kubectl get pods
echo "waiting for the pvmigrate job to complete"
spinner_until 240 job_completed default pvmigrate
kubectl get pods
# if the pvmigrate job exists, wait for it to complete
if kubectl get job -n default pvmigrate; then
kubectl get pods
echo "waiting for the pvmigrate job to complete"
spinner_until 240 job_completed default pvmigrate
kubectl get pods
else
echo "no pvmigrate job found, assuming it was run outside of the cluster"
fi

kubectl get statefulsets
kubectl get deployments
Expand Down

0 comments on commit 3415cf3

Please sign in to comment.