Skip to content

Commit

Permalink
Experiment with just using github.com/pulumi/shard
Browse files Browse the repository at this point in the history
While github.com/pulumi/sharder should be optimal, github.com/pulumi/shard should approach
optimality as the number of tests grows. I want to see the degradation in test performance
we see when using a simpler solution.
  • Loading branch information
iwahbe committed Jan 14, 2025
1 parent 33505e7 commit dfeb591
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7,120 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,10 @@ jobs:
- name: Build PF
run: cd pkg/pf && make build
- name: Shard tests
run: echo "SHARD_CMD=$(go run github.com/pulumi/sharder@828907542fdc6628c49e5139d35fa1f427570550 --total ${{ env.TOTAL_SHARDS }} --index ${{ matrix.shard }} --output test-timings.jsonl --format make)" >> $GITHUB_ENV
if: ${{ matrix.platform == 'ubuntu-latest' }}
- name: Test
run: make VERBOSE=true test_shard
run: echo "RUN_TEST_CMD=$(go run github.com/pulumi/shard@71dd3cca39f7f5433b82e1f3e4b519da4e5c920c --total ${{ env.TOTAL_SHARDS }} --index ${{ matrix.shard }} --seed 42)" >> $GITHUB_ENV
if: ${{ matrix.platform == 'ubuntu-latest' }}
- name: Test
run: make test
if: ${{ matrix.platform != 'ubuntu-latest' }}
- name: Upload coverage reports to Codecov
# If we have a CODECOV_TOKEN secret, then we upload it to get a coverage report.
#
Expand Down
19 changes: 2 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,12 @@ lint:
lint_fix:
go run scripts/build.go fix-lint

RUN_TEST_CMD ?= ./...
test:: 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 a single shard of tests. This is a make target for use in CI. It assumes the shard arguments are provided in SHARD_CMD
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} ./... ${SHARD_CMD}

# Run the tests and record profiling data. This is used for partitioning tests into shards for CI.
test_profile:: install_plugins
@mkdir -p bin
go build -o bin ./internal/testing/pulumi-terraform-bridge-test-provider
rm -f test-timings.jsonl
PULUMI_TERRAFORM_BRIDGE_TEST_PROVIDER=$(shell pwd)/bin/pulumi-terraform-bridge-test-provider \
go test -count=1 -timeout 2h -parallel ${TESTPARALLELISM} ./... -json | \
jq -c -r 'select((.Action == "pass" or .Action == "fail") and .Test != null)' | tee test-timings.jsonl
go test -count=1 -coverprofile="coverage.txt" -coverpkg=./... -timeout 2h -parallel ${TESTPARALLELISM} $(value RUN_TEST_CMD)

# Run tests while accepting current output as expected output "golden"
# tests. In case where system behavior changes intentionally this can
Expand Down
Loading

0 comments on commit dfeb591

Please sign in to comment.