Skip to content

Commit 6715993

Browse files
authored
ci: add azure ipam and azure ip masq merger uts to pipeline (#3756)
* add azure-ip-masq-merger to go work and include other modules in uts * modify CODEOWNERS * add individual module coverage
1 parent 321acb0 commit 6715993

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

.github/CODEOWNERS

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
# review a PR in an area.
88
#
99
# Rules are evaluated in this order, and the last match is used for auto-assignment.
10-
* @azure/azure-sdn-members
11-
/.github/ @azure/acn-admins
12-
/cns/ @azure/acn-cns-reviewers
13-
/cni/ @azure/acn-cni-reviewers
14-
/dropgz/ @rbtr @camrynl @paulyufan2 @ashvindeodhar @thatmattlong
15-
/npm/ @azure/acn-npm-reviewers
16-
/zapai/ @rbtr @ZetaoZhuang
10+
* @azure/azure-sdn-members
11+
/.github/ @azure/acn-admins
12+
/cns/ @azure/acn-cns-reviewers
13+
/cni/ @azure/acn-cni-reviewers
14+
/dropgz/ @rbtr @camrynl @paulyufan2 @ashvindeodhar @thatmattlong
15+
/npm/ @azure/acn-npm-reviewers
16+
/zapai/ @rbtr @ZetaoZhuang
17+
/bpf-prog/ @camrynl
18+
/azure-ip-masq-merger/ @QxBytes @santhoshmprabhu

.pipelines/templates/run-unit-tests.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ stages:
2525
} 3>&1;
2626
} | { read xs; exit $xs; }
2727
} 4>&1
28-
29-
mv coverage-all.out linux-coverage.out
28+
29+
# combine coverage from multiple modules
30+
(echo "mode: atomic"; tail -q -n +2 coverage-*.out) > coverage.cover
31+
mv coverage.cover linux-coverage.out
3032
retryCountOnTaskFailure: 3
3133
name: "Test"
3234
displayName: "Run Tests"
@@ -75,6 +77,9 @@ stages:
7577
artifact: 'linux-coverage'
7678
path: './'
7779
- bash: |
80+
# use go work to include multiple modules or gocov will omit results from those modules
81+
make workspace
82+
7883
make tools
7984
sudo ln -s $(pwd)/build/tools/bin/gocov /usr/local/bin/gocov
8085
sudo ln -s $(pwd)/build/tools/bin/gocov-xml /usr/local/bin/gocov-xml

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ workspace: ## Set up the Go workspace.
810810
go work init
811811
go work use .
812812
go work use ./azure-ipam
813+
go work use ./azure-ip-masq-merger
813814
go work use ./build/tools
814815
go work use ./dropgz
815816
go work use ./zapai
@@ -822,9 +823,11 @@ RESTART_CASE ?= false
822823
# CNI type is a key to direct the types of state validation done on a cluster.
823824
CNI_TYPE ?= cilium
824825

825-
test-all: ## run all unit tests.
826-
go test -mod=readonly -buildvcs=false -tags "unit" --skip 'TestE2E*' -race -covermode atomic -coverprofile=coverage-all.out $(COVER_PKG)/...
827-
go tool cover -func=coverage-all.out
826+
test-all: test-azure-ipam test-azure-ip-masq-merger test-main ## run all unit tests.
827+
828+
test-main:
829+
go test -mod=readonly -buildvcs=false -tags "unit" --skip 'TestE2E*' -race -covermode atomic -coverprofile=coverage-main.out $(COVER_PKG)/...
830+
go tool cover -func=coverage-main.out
828831

829832
test-integration: ## run all integration tests.
830833
AZURE_IPAM_VERSION=$(AZURE_IPAM_VERSION) \
@@ -855,10 +858,10 @@ test-extended-cyclonus: ## run the cyclonus test for npm.
855858
cd ..
856859

857860
test-azure-ipam: ## run the unit test for azure-ipam
858-
cd $(AZURE_IPAM_DIR) && go test
861+
cd $(AZURE_IPAM_DIR) && go test -race -covermode atomic -coverprofile=../coverage-azure-ipam.out && go tool cover -func=../coverage-azure-ipam.out
859862

860863
test-azure-ip-masq-merger: ## run the unit test for azure-ip-masq-merger
861-
cd $(AZURE_IP_MASQ_MERGER_DIR) && go test
864+
cd $(AZURE_IP_MASQ_MERGER_DIR) && go test -race -covermode atomic -coverprofile=../coverage-azure-ip-masq-merger.out && go tool cover -func=../coverage-azure-ip-masq-merger.out
862865

863866
kind:
864867
kind create cluster --config ./test/kind/kind.yaml

0 commit comments

Comments
 (0)