Skip to content

Commit

Permalink
test sharding
Browse files Browse the repository at this point in the history
  • Loading branch information
VenelinMartinov committed Jan 6, 2025
1 parent 2d20150 commit bce5fde
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
required: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TOTAL_SHARDS: 10

jobs:
test:
Expand All @@ -21,6 +22,7 @@ jobs:
go-version: [1.22.x, 1.23.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
feature-flags: ["DEFAULT", "PULUMI_TF_BRIDGE_ACCURATE_BRIDGE_PREVIEW"]
shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
runs-on: ${{ matrix.platform }}
steps:
- name: Install pulumi
Expand All @@ -45,8 +47,10 @@ jobs:
run: make build
- name: Build PF
run: cd pkg/pf && make build
- name: Shard tests
run: go run github.com/VenelinMartinov/shard@7112b4d --total ${{ env.TOTAL_SHARDS }} --index ${{ matrix.shard }} --output env --exclude ".*vendor.*" >> $env:GITHUB_ENV
- name: Test
run: make test
run: make VERBOSE=true test_shard
- name: Upload coverage reports to Codecov
# If we have a CODECOV_TOKEN secret, then we upload it to get a coverage report.
#
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ test:: install_plugins
PULUMI_TERRAFORM_BRIDGE_TEST_PROVIDER=$(shell pwd)/bin/pulumi-terraform-bridge-test-provider \
go test -count=1 -coverprofile="coverage.txt" -coverpkg=./... -timeout 2h -parallel ${TESTPARALLELISM} ./...

test_shard:: install_plugins
@mkdir -p bin
go build -o bin ./internal/testing/pulumi-terraform-bridge-test-provider

PULUMI_TERRAFORM_BRIDGE_TEST_PROVIDER=$(shell pwd)/bin/pulumi-terraform-bridge-test-provider \
go test -count=1 -coverprofile="coverage.txt" -coverpkg=./... -timeout 2h -parallel ${TESTPARALLELISM} ./... -run "${SHARD_TESTS}" ${SHARD_PATHS}

# Run tests while accepting current output as expected output "golden"
# tests. In case where system behavior changes intentionally this can
# be useful to run to review the differences with git diff.
Expand Down
2 changes: 1 addition & 1 deletion pkg/pf/tests/provider_configure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ func TestConfigureBooleans(t *testing.T) {
}`)
}

func TestConfigureErrorReplacement(t *testing.T) {
func TestConfigureErrorReplacementPF(t *testing.T) {
t.Parallel()
t.Run("replace_config_properties", func(t *testing.T) {
errString := `some error with "config_property" and "config" but not config`
Expand Down
2 changes: 1 addition & 1 deletion pkg/tfbridge/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1988,7 +1988,7 @@ func TestConfigure(t *testing.T) {
})
}

func TestConfigureErrorReplacement(t *testing.T) {
func TestConfigureErrorReplacementSDKv2(t *testing.T) {
t.Parallel()
t.Run("replace_config_properties", func(t *testing.T) {
p := testprovider.ProviderV2()
Expand Down

0 comments on commit bce5fde

Please sign in to comment.