Skip to content

Commit fef033d

Browse files
test sharding
1 parent 2d20150 commit fef033d

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

.github/workflows/build-and-test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
required: false
99
env:
1010
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
TOTAL_SHARDS: 10
1112

1213
jobs:
1314
test:
@@ -21,6 +22,7 @@ jobs:
2122
go-version: [1.22.x, 1.23.x]
2223
platform: [ubuntu-latest, macos-latest, windows-latest]
2324
feature-flags: ["DEFAULT", "PULUMI_TF_BRIDGE_ACCURATE_BRIDGE_PREVIEW"]
25+
shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2426
runs-on: ${{ matrix.platform }}
2527
steps:
2628
- name: Install pulumi
@@ -45,8 +47,10 @@ jobs:
4547
run: make build
4648
- name: Build PF
4749
run: cd pkg/pf && make build
50+
- name: Shard tests
51+
run: go run github.com/VenelinMartinov/shard@7112b4d --total ${{ env.TOTAL_SHARDS }} --index ${{ matrix.shard }} --output env --exclude ".*vendor.*" >> $env:GITHUB_ENV
4852
- name: Test
49-
run: make test
53+
run: make VERBOSE=true test_shard
5054
- name: Upload coverage reports to Codecov
5155
# If we have a CODECOV_TOKEN secret, then we upload it to get a coverage report.
5256
#

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ test:: install_plugins
3333
PULUMI_TERRAFORM_BRIDGE_TEST_PROVIDER=$(shell pwd)/bin/pulumi-terraform-bridge-test-provider \
3434
go test -count=1 -coverprofile="coverage.txt" -coverpkg=./... -timeout 2h -parallel ${TESTPARALLELISM} ./...
3535

36+
test_shard:: install_plugins
37+
@mkdir -p bin
38+
go build -o bin ./internal/testing/pulumi-terraform-bridge-test-provider
39+
PULUMI_TERRAFORM_BRIDGE_TEST_PROVIDER=$(shell pwd)/bin/pulumi-terraform-bridge-test-provider \
40+
go test -count=1 -coverprofile="coverage.txt" -coverpkg=./... -timeout 2h -parallel ${TESTPARALLELISM} ./... -run "${SHARD_TESTS}" ${SHARD_PATHS}
41+
3642
# Run tests while accepting current output as expected output "golden"
3743
# tests. In case where system behavior changes intentionally this can
3844
# be useful to run to review the differences with git diff.

pkg/pf/tests/provider_configure_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ func TestConfigureBooleans(t *testing.T) {
534534
}`)
535535
}
536536

537-
func TestConfigureErrorReplacement(t *testing.T) {
537+
func TestConfigureErrorReplacementPF(t *testing.T) {
538538
t.Parallel()
539539
t.Run("replace_config_properties", func(t *testing.T) {
540540
errString := `some error with "config_property" and "config" but not config`

pkg/tfbridge/provider_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ func TestConfigure(t *testing.T) {
19881988
})
19891989
}
19901990

1991-
func TestConfigureErrorReplacement(t *testing.T) {
1991+
func TestConfigureErrorReplacementSDKv2(t *testing.T) {
19921992
t.Parallel()
19931993
t.Run("replace_config_properties", func(t *testing.T) {
19941994
p := testprovider.ProviderV2()

0 commit comments

Comments
 (0)