From 0a7022266f2a5249949134f08b24a62824a4bb7e Mon Sep 17 00:00:00 2001 From: QxBytes Date: Tue, 24 Jun 2025 15:27:08 -0700 Subject: [PATCH 1/3] add azure-ip-masq-merger to go work and include other modules in uts --- .pipelines/templates/run-unit-tests.yaml | 9 +++++++-- Makefile | 12 +++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.pipelines/templates/run-unit-tests.yaml b/.pipelines/templates/run-unit-tests.yaml index 4de945ddc0..07ad30c9eb 100644 --- a/.pipelines/templates/run-unit-tests.yaml +++ b/.pipelines/templates/run-unit-tests.yaml @@ -25,8 +25,10 @@ stages: } 3>&1; } | { read xs; exit $xs; } } 4>&1 - - mv coverage-all.out linux-coverage.out + + # combine coverage from multiple modules + (echo "mode: atomic"; tail -q -n +2 coverage-*.out) > coverage.cover + mv coverage.cover linux-coverage.out retryCountOnTaskFailure: 3 name: "Test" displayName: "Run Tests" @@ -75,6 +77,9 @@ stages: artifact: 'linux-coverage' path: './' - bash: | + # use go work to include multiple modules or gocov will omit results from those modules + make workspace + make tools sudo ln -s $(pwd)/build/tools/bin/gocov /usr/local/bin/gocov sudo ln -s $(pwd)/build/tools/bin/gocov-xml /usr/local/bin/gocov-xml diff --git a/Makefile b/Makefile index b1367cc035..89c5177d8f 100644 --- a/Makefile +++ b/Makefile @@ -810,6 +810,7 @@ workspace: ## Set up the Go workspace. go work init go work use . go work use ./azure-ipam + go work use ./azure-ip-masq-merger go work use ./build/tools go work use ./dropgz go work use ./zapai @@ -822,9 +823,10 @@ RESTART_CASE ?= false # CNI type is a key to direct the types of state validation done on a cluster. CNI_TYPE ?= cilium -test-all: ## run all unit tests. - go test -mod=readonly -buildvcs=false -tags "unit" --skip 'TestE2E*' -race -covermode atomic -coverprofile=coverage-all.out $(COVER_PKG)/... - go tool cover -func=coverage-all.out +test-all: test-azure-ipam test-azure-ip-masq-merger test-main ## run all unit tests. + +test-main: + go test -mod=readonly -buildvcs=false -tags "unit" --skip 'TestE2E*' -race -covermode atomic -coverprofile=coverage-main.out $(COVER_PKG)/... test-integration: ## run all integration tests. AZURE_IPAM_VERSION=$(AZURE_IPAM_VERSION) \ @@ -855,10 +857,10 @@ test-extended-cyclonus: ## run the cyclonus test for npm. cd .. test-azure-ipam: ## run the unit test for azure-ipam - cd $(AZURE_IPAM_DIR) && go test + cd $(AZURE_IPAM_DIR) && go test -race -covermode atomic -coverprofile=../coverage-azure-ipam.out test-azure-ip-masq-merger: ## run the unit test for azure-ip-masq-merger - cd $(AZURE_IP_MASQ_MERGER_DIR) && go test + cd $(AZURE_IP_MASQ_MERGER_DIR) && go test -race -covermode atomic -coverprofile=../coverage-azure-ip-masq-merger.out kind: kind create cluster --config ./test/kind/kind.yaml From 44f150b16f7cfcbf2d9e9f946e4865653a3304e2 Mon Sep 17 00:00:00 2001 From: QxBytes Date: Tue, 24 Jun 2025 15:47:22 -0700 Subject: [PATCH 2/3] modify CODEOWNERS --- .github/CODEOWNERS | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 022b1dfc96..b29da1f5a7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7,10 +7,12 @@ # review a PR in an area. # # Rules are evaluated in this order, and the last match is used for auto-assignment. -* @azure/azure-sdn-members -/.github/ @azure/acn-admins -/cns/ @azure/acn-cns-reviewers -/cni/ @azure/acn-cni-reviewers -/dropgz/ @rbtr @camrynl @paulyufan2 @ashvindeodhar @thatmattlong -/npm/ @azure/acn-npm-reviewers -/zapai/ @rbtr @ZetaoZhuang +* @azure/azure-sdn-members +/.github/ @azure/acn-admins +/cns/ @azure/acn-cns-reviewers +/cni/ @azure/acn-cni-reviewers +/dropgz/ @rbtr @camrynl @paulyufan2 @ashvindeodhar @thatmattlong +/npm/ @azure/acn-npm-reviewers +/zapai/ @rbtr @ZetaoZhuang +/bpf-prog/ @camrynl +/azure-ip-masq-merger/ @QxBytes @santhoshmprabhu From dc9b13dd8999d0b3751a7f61bdf9377ef6dc2451 Mon Sep 17 00:00:00 2001 From: QxBytes Date: Tue, 24 Jun 2025 16:17:04 -0700 Subject: [PATCH 3/3] add individual module coverage --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 89c5177d8f..9c34200ccb 100644 --- a/Makefile +++ b/Makefile @@ -827,6 +827,7 @@ test-all: test-azure-ipam test-azure-ip-masq-merger test-main ## run all unit te test-main: go test -mod=readonly -buildvcs=false -tags "unit" --skip 'TestE2E*' -race -covermode atomic -coverprofile=coverage-main.out $(COVER_PKG)/... + go tool cover -func=coverage-main.out test-integration: ## run all integration tests. AZURE_IPAM_VERSION=$(AZURE_IPAM_VERSION) \ @@ -857,10 +858,10 @@ test-extended-cyclonus: ## run the cyclonus test for npm. cd .. test-azure-ipam: ## run the unit test for azure-ipam - cd $(AZURE_IPAM_DIR) && go test -race -covermode atomic -coverprofile=../coverage-azure-ipam.out + cd $(AZURE_IPAM_DIR) && go test -race -covermode atomic -coverprofile=../coverage-azure-ipam.out && go tool cover -func=../coverage-azure-ipam.out test-azure-ip-masq-merger: ## run the unit test for azure-ip-masq-merger - cd $(AZURE_IP_MASQ_MERGER_DIR) && go test -race -covermode atomic -coverprofile=../coverage-azure-ip-masq-merger.out + 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 kind: kind create cluster --config ./test/kind/kind.yaml