Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run integration tests both in a cluster job and on the CLI #232

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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