Skip to content

Commit 0afb5e4

Browse files
committed
add integration test for pre-sync-mode
1 parent 2ced425 commit 0afb5e4

File tree

2 files changed

+95
-7
lines changed

2 files changed

+95
-7
lines changed

.github/workflows/build-test.yaml

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
- name: Set up Go
1717
uses: actions/setup-go@v5
1818
with:
19-
go-version: 1.22
19+
go-version-file: go.mod
20+
cache-dependency-path: go.sum
2021

2122
- name: Test
2223
run: make test
@@ -29,7 +30,8 @@ jobs:
2930
- name: Set up Go
3031
uses: actions/setup-go@v5
3132
with:
32-
go-version: 1.22
33+
go-version-file: go.mod
34+
cache-dependency-path: go.sum
3335

3436
- name: Build
3537
run: make build
@@ -46,6 +48,32 @@ jobs:
4648
- name: Validate Cluster End State
4749
run: ./testing/validate.sh
4850

51+
integration-test-presync:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up Go
57+
uses: actions/setup-go@v5
58+
with:
59+
go-version-file: go.mod
60+
cache-dependency-path: go.sum
61+
62+
- name: Build
63+
run: make build
64+
65+
- name: Create k8s Kind Cluster
66+
uses: helm/kind-action@v1.10.0
67+
68+
- name: Create Testdata in Cluster
69+
run: ./testing/init.sh
70+
71+
- name: Run PVMigrate
72+
run: ./bin/pvmigrate --source-sc int-source --dest-sc int-dest --pre-sync-mode
73+
74+
- name: Validate Cluster End State
75+
run: ./testing/validate.sh
76+
4977
integration-test-incluster:
5078
runs-on: ubuntu-latest
5179
steps:
@@ -54,7 +82,8 @@ jobs:
5482
- name: Set up Go
5583
uses: actions/setup-go@v5
5684
with:
57-
go-version: 1.22
85+
go-version-file: go.mod
86+
cache-dependency-path: go.sum
5887

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

75104
- name: Validate Cluster End State
76105
run: ./testing/validate.sh
106+
107+
# this job will validate that all the tests passed
108+
# it is used for the github branch protection rule
109+
validate-success:
110+
name: Validate success
111+
runs-on: ubuntu-24.04
112+
needs:
113+
- unit-test
114+
- integration-test
115+
- integration-test-presync
116+
- integration-test-incluster
117+
if: always()
118+
steps:
119+
# https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context
120+
- name: fail if unit-test job was not successful
121+
if: needs.unit-test.result != 'success'
122+
run: exit 1
123+
- name: fail if integration-test job was not successful
124+
if: needs.integration-test.result != 'success'
125+
run: exit 1
126+
- name: fail if integration-test-presync job was not successful
127+
if: needs.integration-test-presync.result != 'success'
128+
run: exit 1
129+
- name: fail if integration-test-incluster job was not successful
130+
if: needs.integration-test-incluster.result != 'success'
131+
run: exit 1
132+
- name: succeed if everything else passed
133+
run: echo "Validation succeeded"

.github/workflows/release.yaml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs:
1515
- name: Set up Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: 1.22
18+
go-version-file: go.mod
19+
cache-dependency-path: go.sum
1920

2021
- name: Test
2122
run: make test
@@ -28,7 +29,8 @@ jobs:
2829
- name: Set up Go
2930
uses: actions/setup-go@v5
3031
with:
31-
go-version: 1.22
32+
go-version-file: go.mod
33+
cache-dependency-path: go.sum
3234

3335
- name: Build
3436
run: make build
@@ -45,6 +47,32 @@ jobs:
4547
- name: Validate Cluster End State
4648
run: ./testing/validate.sh
4749

50+
integration-test-presync:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Set up Go
56+
uses: actions/setup-go@v5
57+
with:
58+
go-version-file: go.mod
59+
cache-dependency-path: go.sum
60+
61+
- name: Build
62+
run: make build
63+
64+
- name: Create k8s Kind Cluster
65+
uses: helm/kind-action@v1.10.0
66+
67+
- name: Create Testdata in Cluster
68+
run: ./testing/init.sh
69+
70+
- name: Run PVMigrate
71+
run: ./bin/pvmigrate --source-sc int-source --dest-sc int-dest --pre-sync-mode
72+
73+
- name: Validate Cluster End State
74+
run: ./testing/validate.sh
75+
4876
integration-test-incluster:
4977
runs-on: ubuntu-latest
5078
steps:
@@ -53,7 +81,8 @@ jobs:
5381
- name: Set up Go
5482
uses: actions/setup-go@v5
5583
with:
56-
go-version: 1.22
84+
go-version-file: go.mod
85+
cache-dependency-path: go.sum
5786

5887
- name: Build and push
5988
uses: docker/build-push-action@v6
@@ -80,6 +109,7 @@ jobs:
80109
- unit-test
81110
- integration-test
82111
- integration-test-incluster
112+
- integration-test-presync
83113
if: startsWith(github.ref, 'refs/tags/v')
84114
steps:
85115
- name: Checkout
@@ -90,7 +120,8 @@ jobs:
90120

91121
- uses: actions/setup-go@v5
92122
with:
93-
go-version: 1.22
123+
go-version-file: go.mod
124+
cache-dependency-path: go.sum
94125

95126
- name: Run GoReleaser
96127
uses: goreleaser/goreleaser-action@v6

0 commit comments

Comments
 (0)