Skip to content

Commit ba605ac

Browse files
Tidy test execution
- Make: Skip expanding then passing the list of go packages. `./...` does this for us. - Use gotestfmt in CI/CD for better output. Still set same coverage flags as in make. - Increase explicit `-parallel` from program test in CI to 16. Tests are not bound on local resources but rather on waiting for external services.
1 parent 20b23aa commit ba605ac

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.github/workflows/build-test.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ jobs:
151151
OIDC_ARM_CLIENT_ID: ${{ inputs.oidc_arm_client_id }}
152152
run: |
153153
set -euo pipefail
154-
cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
154+
cd examples && go test -v -json -cover -timeout 2h -tags=${{ matrix.language }} -parallel 16 . 2>&1 | tee /tmp/gotest.log | gotestfmt
155155
156156
- name: Run short tests
157157
if: inputs.short_test
158158
run: |
159159
set -euo pipefail
160-
cd examples && go test -v -json -count=1 -cover -timeout 15m -short -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
160+
cd examples && go test -v -json -cover -timeout 15m -short -tags=${{ matrix.language }} -parallel 16 . 2>&1 | tee /tmp/gotest.log | gotestfmt
161161
162162
- name: Tar SDK folder
163163
if: ${{ matrix.language != 'go' }}
@@ -207,6 +207,12 @@ jobs:
207207
with:
208208
skip_dotnet_and_java: "true"
209209

210+
- name: Install gotestfmt
211+
uses: jaxxstorm/action-install-gh-release@v1.9.0
212+
with:
213+
tag: v2.4.0
214+
repo: GoTestTools/gotestfmt
215+
210216
- run: make ensure
211217

212218
- name: Prerequisites artifact restore
@@ -216,7 +222,9 @@ jobs:
216222
run: make --touch codegen schema provider
217223

218224
- name: Test Provider Library
219-
run: PROVIDER_TEST_TAGS=all make test_provider
225+
run: |
226+
set -euo pipefail
227+
cd provider && go test -v -json -coverprofile="coverage.txt" -coverpkg=./... -timeout 1h -parallel 16 ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
220228
221229
- name: Upload coverage reports to Codecov
222230
uses: codecov/codecov-action@v3

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ PROJECT := github.com/pulumi/pulumi-azure-native
44
PROVIDER := pulumi-resource-azure-native
55
CODEGEN := pulumi-gen-azure-native
66

7-
PROVIDER_PKGS := $(shell cd ./provider && go list ./pkg/...)
87
WORKING_DIR := $(shell pwd)
98

109
# azure-quickstart-templates is generated by arm2pulumi_coverage_report
@@ -126,7 +125,7 @@ arm2pulumi_coverage_report: .make/provider_mod_download provider/cmd/$(PROVIDER)
126125
PROVIDER_TEST_TAGS ?= unit # Default to unit tests only for quick local feedback
127126
.PHONY: test_provider
128127
test_provider: .make/provider_mod_download .make/provider_prebuild provider/cmd/$(PROVIDER)/*.go $(PROVIDER_PKG)
129-
cd provider && go test -v --tags=$(PROVIDER_TEST_TAGS) -coverprofile="coverage.txt" -coverpkg=./... $(PROVIDER_PKGS)
128+
cd provider && go test -v --tags=$(PROVIDER_TEST_TAGS) -coverprofile="coverage.txt" -coverpkg=./... ./...
130129

131130
.PHONY: lint_provider
132131
lint_provider: .make/provider_mod_download provider/cmd/$(PROVIDER)/*.go $(PROVIDER_PKG)

0 commit comments

Comments
 (0)