Skip to content

Commit

Permalink
Make pipeline fail when e2e tests fail (#2261)
Browse files Browse the repository at this point in the history
  • Loading branch information
gapra-msft authored Jun 22, 2023
1 parent 23ff0ec commit ec1f637
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,27 @@ jobs:
display_name: "Linux"
go_path: '$(go env GOPATH)/bin/'
suffix: ''
run_e2e: 'go test -timeout=1h -v ./e2etest | tee test.txt'
save_exit_code: 'exit_code=${PIPESTATUS[0]}'
return_exit_code: 'exit "$exit_code"'
Windows:
imageName: 'windows-2019'
build_name: 'azcopy_windows_amd64.exe'
display_name: "Windows"
go_path: 'C:\Users\VssAdministrator\go\bin\'
suffix: '.exe'
run_e2e: 'go test -timeout=1h -v ./e2etest > test.txt'
save_exit_code: 'set exit_code=%errorlevel%'
return_exit_code: 'exit %exit_code%'
MacOS:
imageName: 'macos-11'
build_name: 'azcopy_darwin_amd64'
display_name: "MacOS"
go_path: '$(go env GOPATH)/bin/'
suffix: ''
run_e2e: 'go test -timeout=1h -v ./e2etest | tee test.txt'
save_exit_code: 'exit_code=${PIPESTATUS[0]}'
return_exit_code: 'exit "$exit_code"'
pool:
vmImage: $(imageName)

Expand All @@ -158,13 +167,17 @@ jobs:
echo 'Building executable'
go build -cover -o $(build_name)
echo 'Running tests'
go test -timeout=1h -v ./e2etest 2>&1 | $(go_path)go-junit-report$(suffix) > report.xml
$(run_e2e)
$(save_exit_code)
echo "Generating junit report"
cat test.txt | $(go_path)go-junit-report$(suffix) > report.xml
echo 'Formatting coverage directory to legacy txt format'
go tool covdata textfmt -i=coverage -o coverage.txt
echo 'Formatting coverage to json format'
$(go_path)gocov$(suffix) convert coverage.txt > coverage.json
echo 'Formatting coverage to xml format'
$(go_path)gocov-xml$(suffix) < coverage.json > coverage.xml
$(return_exit_code)
env:
AZCOPY_E2E_ACCOUNT_KEY: $(AZCOPY_E2E_ACCOUNT_KEY)
AZCOPY_E2E_ACCOUNT_NAME: $(AZCOPY_E2E_ACCOUNT_NAME)
Expand Down

0 comments on commit ec1f637

Please sign in to comment.