You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci: add code coverage publishing and check to pipeline (#3544)
* generate code coverage
* ut regression check
* move coverage report generation to separate step
* move link where it's needed
* add windows ut coverage
* publish multiple coverage reports since unable to merge diff oses
* remove debug always succeed
Copy file name to clipboardExpand all lines: .pipelines/templates/run-unit-tests.yaml
+71-2
Original file line number
Diff line number
Diff line change
@@ -12,18 +12,28 @@ stages:
12
12
name: "$(BUILD_POOL_NAME_DEFAULT)"
13
13
steps:
14
14
- script: |
15
+
set -e
15
16
make tools
16
-
# run test, echo exit status code to fd 3, pipe output from test to tee, which splits output to stdout and go-junit-report (which converts test output to report.xml), stdout from tee is redirected to fd 4. Take output written to fd 3 (which is the exit code of test), redirect to stdout, pipe to read from stdout then exit with that status code. Read all output from fd 4 (output from tee) and write to top stdout
17
+
18
+
# run test, echo exit status code to fd 3, pipe output from test to tee, which splits output to stdout and go-junit-report (which converts test output to report.xml),
19
+
# stdout from tee is redirected to fd 4. Take output written to fd 3 (which is the exit code of test), redirect to stdout, pipe to read from stdout then exit with that status code.
20
+
# Read all output from fd 4 (output from tee) and write to top stdout
17
21
{ { { {
18
22
sudo -E env "PATH=$PATH" make test-all;
19
23
echo $? >&3;
20
24
} | tee >(build/tools/bin/go-junit-report > report.xml) >&4;
21
25
} 3>&1;
22
26
} | { read xs; exit $xs; }
23
27
} 4>&1
28
+
29
+
mv coverage-all.out linux-coverage.out
24
30
retryCountOnTaskFailure: 3
25
31
name: "Test"
26
32
displayName: "Run Tests"
33
+
- task: PublishPipelineArtifact@1
34
+
inputs:
35
+
targetPath: 'linux-coverage.out'
36
+
artifactName: 'linux-coverage'
27
37
28
38
- stage: test_windows
29
39
displayName: Test ACN Windows
@@ -40,7 +50,66 @@ stages:
40
50
# Only run one go test per script
41
51
- script: |
42
52
cd azure-container-networking/
43
-
go test -timeout 30m ./npm/... ./cni/... ./platform/...
53
+
go test -timeout 30m -covermode atomic -coverprofile=windows-coverage.out ./npm/... ./cni/... ./platform/...
0 commit comments