Skip to content

Commit eb555c7

Browse files
test sharding
1 parent dbc1c2d commit eb555c7

File tree

8 files changed

+7185
-1097
lines changed

8 files changed

+7185
-1097
lines changed

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

Lines changed: 50 additions & 0 deletions
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,48 @@ 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]
26+
exclude:
27+
- platform: windows-latest
28+
feature-flags: "PULUMI_TF_BRIDGE_ACCURATE_BRIDGE_PREVIEW"
29+
- platform: macos-latest
30+
feature-flags: "PULUMI_TF_BRIDGE_ACCURATE_BRIDGE_PREVIEW"
31+
- platform: windows-latest
32+
shard: 1
33+
- platform: windows-latest
34+
shard: 2
35+
- platform: windows-latest
36+
shard: 3
37+
- platform: windows-latest
38+
shard: 4
39+
- platform: windows-latest
40+
shard: 5
41+
- platform: windows-latest
42+
shard: 6
43+
- platform: windows-latest
44+
shard: 7
45+
- platform: windows-latest
46+
shard: 8
47+
- platform: windows-latest
48+
shard: 9
49+
- platform: macos-latest
50+
shard: 1
51+
- platform: macos-latest
52+
shard: 2
53+
- platform: macos-latest
54+
shard: 3
55+
- platform: macos-latest
56+
shard: 4
57+
- platform: macos-latest
58+
shard: 5
59+
- platform: macos-latest
60+
shard: 6
61+
- platform: macos-latest
62+
shard: 7
63+
- platform: macos-latest
64+
shard: 8
65+
- platform: macos-latest
66+
shard: 9
2467
runs-on: ${{ matrix.platform }}
2568
steps:
2669
- name: Install pulumi
@@ -45,8 +88,15 @@ jobs:
4588
run: make build
4689
- name: Build PF
4790
run: cd pkg/pf && make build
91+
- name: Shard tests
92+
run: go run github.com/VenelinMartinov/sharder@afedd5abd19314e70434e3530a13b3ef20ac4e46 --total ${{ env.TOTAL_SHARDS }} --index ${{ matrix.shard }} --format env --output testoutput.txt
93+
- run: echo "$SHARD_CMD"
94+
- name: Test
95+
run: make VERBOSE=true test_shard
96+
if: ${{ matrix.platform == 'ubuntu-latest' }}
4897
- name: Test
4998
run: make test
99+
if: ${{ matrix.platform != 'ubuntu-latest' }}
50100
- name: Upload coverage reports to Codecov
51101
# If we have a CODECOV_TOKEN secret, then we upload it to get a coverage report.
52102
#

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ testing/coverage.txt
1414
pf/coverage.out
1515
pf/tests/coverage.out
1616

17-
pulumi-hcl-lint
17+
pulumi-hcl-lint
18+
19+
schema-tpsdkv2.json

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ 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} ./... ${SHARD_CMD}
41+
42+
test_profile:: install_plugins
43+
@mkdir -p bin
44+
go build -o bin ./internal/testing/pulumi-terraform-bridge-test-provider
45+
rm -f testoutput.txt
46+
PULUMI_TERRAFORM_BRIDGE_TEST_PROVIDER=$(shell pwd)/bin/pulumi-terraform-bridge-test-provider \
47+
go test -count=1 -timeout 2h -parallel ${TESTPARALLELISM} ./... -json | \
48+
jq -c -r 'select((.Action == "pass" or .Action == "fail") and .Test != null)' | tee testoutput.txt
49+
3650
# Run tests while accepting current output as expected output "golden"
3751
# tests. In case where system behavior changes intentionally this can
3852
# 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)