Skip to content

Commit

Permalink
add integration test for pre-sync-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Oct 21, 2024
1 parent 2ced425 commit 0afb5e4
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 7 deletions.
63 changes: 60 additions & 3 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Test
run: make test
Expand All @@ -29,7 +30,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Build
run: make build
Expand All @@ -46,6 +48,32 @@ jobs:
- name: Validate Cluster End State
run: ./testing/validate.sh

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

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum

- 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 --pre-sync-mode

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

integration-test-incluster:
runs-on: ubuntu-latest
steps:
Expand All @@ -54,7 +82,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Build and push
uses: docker/build-push-action@v6
Expand All @@ -74,3 +103,31 @@ jobs:

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

# this job will validate that all the tests passed
# it is used for the github branch protection rule
validate-success:
name: Validate success
runs-on: ubuntu-24.04
needs:
- unit-test
- integration-test
- integration-test-presync
- integration-test-incluster
if: always()
steps:
# https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context
- name: fail if unit-test job was not successful
if: needs.unit-test.result != 'success'
run: exit 1
- name: fail if integration-test job was not successful
if: needs.integration-test.result != 'success'
run: exit 1
- name: fail if integration-test-presync job was not successful
if: needs.integration-test-presync.result != 'success'
run: exit 1
- name: fail if integration-test-incluster job was not successful
if: needs.integration-test-incluster.result != 'success'
run: exit 1
- name: succeed if everything else passed
run: echo "Validation succeeded"
39 changes: 35 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Test
run: make test
Expand All @@ -28,7 +29,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Build
run: make build
Expand All @@ -45,6 +47,32 @@ jobs:
- name: Validate Cluster End State
run: ./testing/validate.sh

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

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum

- 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 --pre-sync-mode

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

integration-test-incluster:
runs-on: ubuntu-latest
steps:
Expand All @@ -53,7 +81,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Build and push
uses: docker/build-push-action@v6
Expand All @@ -80,6 +109,7 @@ jobs:
- unit-test
- integration-test
- integration-test-incluster
- integration-test-presync
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
Expand All @@ -90,7 +120,8 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
Expand Down

0 comments on commit 0afb5e4

Please sign in to comment.