diff --git a/eng/pipelines/templates/steps/build-test.yml b/eng/pipelines/templates/steps/build-test.yml index ce16e43eb9d8..5b9f89b0b6f2 100644 --- a/eng/pipelines/templates/steps/build-test.yml +++ b/eng/pipelines/templates/steps/build-test.yml @@ -34,8 +34,10 @@ steps: $testDirs = (./eng/scripts/get_test_dirs.ps1 -serviceDir $(SCOPE)) foreach ($td in $testDirs) { pushd $td - Write-Host "##[command]Executing go test -run "^Test" -v -coverprofile coverage.txt $td | go-junit-report -set-exit-code > report.xml" - go test -run "^Test" -v -coverprofile coverage.txt . | go-junit-report -set-exit-code > report.xml + Write-Host "##[command]Executing 'go test -run "^Test" -v -coverprofile coverage.txt .' in $td" + go test -run "^Test" -v -coverprofile coverage.txt . | Tee-Object -FilePath outfile.txt + if ($LASTEXITCODE) { exit $LASTEXITCODE } + cat outfile.txt | go-junit-report > report.xml # if no tests were actually run (e.g. examples) delete the coverage file so it's omitted from the coverage report if (Select-String -path ./report.xml -pattern '' -simplematch -quiet) { Write-Host "##[command]Deleting empty coverage file" diff --git a/sdk/postgresql/armpostgresql/go_mod_tidy_hack.go b/sdk/postgresql/armpostgresql/go_mod_tidy_hack.go index ef6ba5b13152..1ada8852612e 100644 --- a/sdk/postgresql/armpostgresql/go_mod_tidy_hack.go +++ b/sdk/postgresql/armpostgresql/go_mod_tidy_hack.go @@ -9,4 +9,4 @@ package armpostgresql // Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository -import _ "github.com/Azure/azure-sdk-for-go" \ No newline at end of file +import _ "github.com/Azure/azure-sdk-for-go"