Skip to content

Commit

Permalink
wip: Remove bincover
Browse files Browse the repository at this point in the history
Signed-off-by: Shikhar Soni <[email protected]>
  • Loading branch information
shikharish committed Mar 11, 2024
1 parent daed98b commit 4851993
Show file tree
Hide file tree
Showing 21 changed files with 94 additions and 188 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ jobs:
mkdir log
mkdir test-e2e-encap-coverage
ANTREA_LOG_DIR=$PWD/log ANTREA_COV_DIR=$PWD/test-e2e-encap-coverage ./ci/kind/test-e2e-kind.sh --encap-mode encap --coverage
- name: Generate coverage files
run: |
cd test-e2e-encap-coverage
for dir in */; do go tool covdata textfmt -i="${dir}" -o "${dir%?}_$(date +%Y-%m-%d_%H-%M-%S).cov.out" && rm -rf "${dir}"; done
cd -
- name: Tar coverage files
run: tar -czf test-e2e-encap-coverage.tar.gz test-e2e-encap-coverage
- name: Upload coverage for test-e2e-encap-coverage
Expand Down Expand Up @@ -170,6 +175,11 @@ jobs:
--feature-gates LoadBalancerModeDSR=true \
--load-balancer-mode dsr \
--node-ipam
- name: Generate coverage files
run: |
cd test-e2e-encap-non-default-coverage
for dir in */; do go tool covdata textfmt -i="${dir}" -o "${dir%?}_$(date +%Y-%m-%d_%H-%M-%S).cov.out" && rm -rf "${dir}"; done
cd -
- name: Tar coverage files
run: tar -czf test-e2e-encap-non-default-coverage.tar.gz test-e2e-encap-non-default-coverage
- name: Upload coverage for test-e2e-encap-non-default-coverage
Expand Down Expand Up @@ -239,6 +249,11 @@ jobs:
--node-ipam \
--extra-vlan \
--multicast
- name: Generate coverage files
run: |
cd test-e2e-encap-all-features-enabled-coverage
for dir in */; do go tool covdata textfmt -i="${dir}" -o "${dir%?}_$(date +%Y-%m-%d_%H-%M-%S).cov.out" && rm -rf "${dir}"; done
cd -
- name: Tar coverage files
run: tar -czf test-e2e-encap-all-features-enabled-coverage.tar.gz test-e2e-encap-all-features-enabled-coverage
- name: Upload coverage for test-e2e-encap-all-features-enabled-coverage
Expand Down Expand Up @@ -301,6 +316,11 @@ jobs:
mkdir log
mkdir test-e2e-noencap-coverage
ANTREA_LOG_DIR=$PWD/log ANTREA_COV_DIR=$PWD/test-e2e-noencap-coverage ./ci/kind/test-e2e-kind.sh --encap-mode noEncap --coverage --skip mode-irrelevant
- name: Generate coverage files
run: |
cd test-e2e-noencap-coverage
for dir in */; do go tool covdata textfmt -i="${dir}" -o "${dir%?}_$(date +%Y-%m-%d_%H-%M-%S).cov.out" && rm -rf "${dir}"; done
cd -
- name: Tar coverage files
run: tar -czf test-e2e-noencap-coverage.tar.gz test-e2e-noencap-coverage
- name: Upload coverage for test-e2e-noencap-coverage
Expand Down Expand Up @@ -363,6 +383,11 @@ jobs:
mkdir log
mkdir test-e2e-hybrid-coverage
ANTREA_LOG_DIR=$PWD/log ANTREA_COV_DIR=$PWD/test-e2e-hybrid-coverage ./ci/kind/test-e2e-kind.sh --encap-mode hybrid --coverage --skip mode-irrelevant
- name: Generate coverage files
run: |
cd test-e2e-hybrid-coverage
for dir in */; do go tool covdata textfmt -i="${dir}" -o "${dir%?}_$(date +%Y-%m-%d_%H-%M-%S).cov.out" && rm -rf "${dir}"; done
cd -
- name: Tar coverage files
run: tar -czf test-e2e-hybrid-coverage.tar.gz test-e2e-hybrid-coverage
- name: Upload coverage for test-e2e-hybrid-coverage
Expand Down Expand Up @@ -437,6 +462,11 @@ jobs:
mkdir log
mkdir test-e2e-fa-coverage
ANTREA_LOG_DIR=$PWD/log ANTREA_COV_DIR=$PWD/test-e2e-fa-coverage ./ci/kind/test-e2e-kind.sh --encap-mode encap --coverage --flow-visibility --ip-family dual
- name: Generate coverage files
run: |
cd test-e2e-fa-coverage
for dir in */; do go tool covdata textfmt -i="${dir}" -o "${dir%?}_$(date +%Y-%m-%d_%H-%M-%S).cov.out" && rm -rf "${dir}"; done
cd -
- name: Tar coverage files
run: tar -czf test-e2e-fa-coverage.tar.gz test-e2e-fa-coverage
- name: Upload coverage for test-e2e-fa-coverage
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ WIN_BUILD_OVS_TAG := $(NANOSERVER_VERSION)-$(WIN_OVS_VERSION)
GIT_HOOKS := $(shell find hack/git_client_side_hooks -type f -print)
DOCKER_NETWORK ?= default
TRIVY_TARGET_IMAGE ?=
GOCOVERDIR ?= "/tmp/coverage"

GOLANGCI_LINT_VERSION := v1.54.0
GOLANGCI_LINT_BINDIR := $(CURDIR)/.golangci-bin
Expand Down Expand Up @@ -106,7 +107,7 @@ antrea-agent-simulator:
.PHONY: antrea-agent-instr-binary
antrea-agent-instr-binary:
@mkdir -p $(BINDIR)
GOOS=linux $(GO) test -tags testbincover -covermode count -coverpkg=antrea.io/antrea/pkg/... -c -o $(BINDIR)/antrea-agent-coverage $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antrea-agent
GOOS=linux $(GO) build -cover -o $(BINDIR)/antrea-agent-coverage -coverpkg=antrea.io/antrea/cmd/antrea-agent,antrea.io/antrea/pkg/... $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antrea-agent

.PHONY: antrea-controller
antrea-controller:
Expand All @@ -120,7 +121,7 @@ antrea-controller:
.PHONY: antrea-controller-instr-binary
antrea-controller-instr-binary:
@mkdir -p $(BINDIR)
GOOS=linux $(GO) test -tags testbincover -covermode count -coverpkg=antrea.io/antrea/pkg/... -c -o $(BINDIR)/antrea-controller-coverage $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antrea-controller
GOOS=linux $(GO) build -cover -o $(BINDIR)/antrea-controller-coverage -coverpkg=antrea.io/antrea/cmd/antrea-controller,antrea.io/antrea/pkg/... $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antrea-controller

.PHONY: antrea-cni
antrea-cni:
Expand All @@ -135,7 +136,7 @@ antrea-cni-release:
.PHONY: antctl-instr-binary
antctl-instr-binary:
@mkdir -p $(BINDIR)
GOOS=linux $(GO) test -tags testbincover -covermode count -coverpkg=antrea.io/antrea/pkg/... -c -o $(BINDIR)/antctl-coverage $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antctl
GOOS=linux $(GO) build -cover -o $(BINDIR)/antctl-coverage -coverpkg=antrea.io/antrea/cmd/antctl,antrea.io/antrea/pkg/... $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antctl

.PHONY: windows-bin
windows-bin:
Expand All @@ -150,7 +151,7 @@ flow-aggregator:
.PHONY: flow-aggregator-instr-binary
flow-aggregator-instr-binary:
@mkdir -p $(BINDIR)
GOOS=linux $(GO) test -tags testbincover -covermode count -coverpkg=antrea.io/antrea/pkg/... -c -o $(BINDIR)/flow-aggregator-coverage $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/flow-aggregator
GOOS=linux $(GO) build -cover -o $(BINDIR)/flow-aggregator-coverage -coverpkg=antrea.io/antrea/cmd/flow-aggregator,antrea.io/antrea/pkg/... $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/flow-aggregator

.PHONY: test-unit test-integration
ifeq ($(UNAME_S),Linux)
Expand Down
6 changes: 5 additions & 1 deletion build/charts/antrea/templates/agent/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ spec:
{{- end }}
# SKIP_CNI_BINARIES takes in values as a comma separated list of
# binaries that need to be skipped for installation, e.g. "portmap, bandwidth".
- name: GOCOVERDIR
value: /tmp/coverage
- name: SKIP_CNI_BINARIES
value: {{ join "," .Values.cni.skipBinaries | quote }}
{{- if .Values.agent.dontLoadKernelModules }}
Expand Down Expand Up @@ -131,7 +133,7 @@ spec:
imagePullPolicy: {{ include "antreaAgentImagePullPolicy" . }}
{{- if ((.Values.testing).coverage) }}
command: ["/bin/sh"]
args: ["-c", "sleep 2; antrea-agent-coverage -test.run=TestBincoverRunMain -test.coverprofile=antrea-agent.cov.out -args-file=/agent-arg-file; while true; do sleep 5 & wait $!; done"]
args: ["-c", "sleep 2; antrea-agent-coverage $(cat /agent-arg-file | tr '\n' ' '); while true; do sleep 5 & wait $!; done"]
{{- else}}
command: ["antrea-agent"]
# Log to both "/var/log/antrea/" and stderr (so "kubectl logs" can work).-
Expand Down Expand Up @@ -163,6 +165,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: GOCOVERDIR
value: /tmp/coverage
{{- if eq .Values.trafficEncryptionMode "ipsec" }}
# Pre-shared key for IPsec IKE.
- name: ANTREA_IPSEC_PSK
Expand Down
4 changes: 3 additions & 1 deletion build/charts/antrea/templates/controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ spec:
resources: {{- .Values.controller.antreaController.resources | toYaml | nindent 12 }}
{{- if ((.Values.testing).coverage) }}
command: ["/bin/sh"]
args: ["-c", "antrea-controller-coverage -test.run=TestBincoverRunMain -test.coverprofile=antrea-controller.cov.out -args-file=/controller-arg-file; while true; do sleep 5 & wait $!; done"]
args: ["-c", "antrea-controller-coverage $(cat /controller-arg-file | tr '\n' ' '); while true; do sleep 5 & wait $!; done"]
{{- else }}
command: ["antrea-controller"]
# Log to both "/var/log/antrea/" and stderr (so "kubectl logs" can work).
Expand All @@ -85,6 +85,8 @@ spec:
{{- end }}
env:
# Provide pod and node information for clusterinformation CRD.
- name: GOCOVERDIR
value: /tmp/coverage
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
4 changes: 3 additions & 1 deletion build/charts/flow-aggregator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.testing.coverage }}
command: [ "/bin/sh" ]
args: [ "-c", "flow-aggregator-coverage -test.run=TestBincoverRunMain -test.coverprofile=flow-aggregator.cov.out -args-file=/flow-aggregator-arg-file; while true; do sleep 5 & wait $!; done" ]
args: [ "-c", "flow-aggregator-coverage $(cat /flow-aggregator-arg-file | tr '\n' ' '); while true; do sleep 5 & wait $!; done" ]
{{- else }}
args:
- --config
Expand All @@ -44,6 +44,8 @@ spec:
{{- end }}
{{- end }}
env:
- name: GOCOVERDIR
value: /tmp/coverage
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
1 change: 1 addition & 0 deletions build/images/Dockerfile.build.agent.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ LABEL description="The Docker image to deploy the antrea-agent with code coverag

USER root

RUN mkdir -p /tmp/coverage
COPY build/images/scripts/* /usr/local/bin/
COPY --from=antrea-build /antrea/bin/antrea-agent /usr/local/bin/
COPY --from=antrea-build /antrea/bin/antrea-agent-coverage /usr/local/bin/
Expand Down
2 changes: 1 addition & 1 deletion build/images/Dockerfile.build.controller.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ RUN go mod download
COPY . /antrea

RUN make antctl-linux antctl-instr-binary && mv bin/antctl-linux bin/antctl

RUN make antrea-controller antrea-controller-instr-binary

FROM ubuntu:22.04
Expand All @@ -35,6 +34,7 @@ LABEL description="The Docker image to deploy the antrea-controller with code co

USER root

RUN mkdir -p /tmp/coverage
COPY --from=antrea-build /antrea/bin/antrea-controller /usr/local/bin/
COPY --from=antrea-build /antrea/bin/antctl /usr/local/bin/
COPY --from=antrea-build /antrea/bin/antrea-controller-coverage /usr/local/bin/
Expand Down
2 changes: 1 addition & 1 deletion build/images/Dockerfile.build.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ COPY . /antrea
# Build antctl first in order to share an extra layer with
# build/images/Dockerfile.build.agent.coverage and build/images/Dockerfile.build.controller.coverage.
RUN make antctl-linux antctl-instr-binary && mv bin/antctl-linux bin/antctl

# Then build antrea-agent and antrea-cni, in order to share an extra layer with
# build/images/Dockerfile.build.agent.coverage.
RUN make antrea-agent antrea-cni antrea-agent-instr-binary
Expand All @@ -41,6 +40,7 @@ LABEL description="The Docker image to deploy the Antrea CNI with code coverage

USER root

RUN mkdir -p /tmp/coverage
COPY build/images/scripts/* /usr/local/bin/
COPY --from=antrea-build /antrea/bin/* /usr/local/bin/
COPY --from=antrea-build /antrea/test/e2e/coverage/controller-arg-file /
Expand Down
1 change: 1 addition & 0 deletions build/images/flow-aggregator/Dockerfile.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ LABEL description="The docker image for the flow aggregator with code coverage m

USER root

RUN mkdir -p /tmp/coverage
COPY --from=flow-aggregator-build /antrea/bin/flow-aggregator* /usr/local/bin/
COPY --from=flow-aggregator-build /antrea/test/e2e/coverage/flow-aggregator-arg-file /
COPY --from=flow-aggregator-build /antrea/bin/antctl* /usr/local/bin/
Expand Down
28 changes: 0 additions & 28 deletions cmd/antctl/bincover_run_main_test.go

This file was deleted.

28 changes: 0 additions & 28 deletions cmd/antrea-agent/bincover_run_main_test.go

This file was deleted.

28 changes: 0 additions & 28 deletions cmd/antrea-controller/bincover_run_main_test.go

This file was deleted.

28 changes: 0 additions & 28 deletions cmd/flow-aggregator/bincover_run_main_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion multicluster/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ bin: fmt vet ## Build manager binary.

.PHONY: antrea-mc-instr-binary
antrea-mc-instr-binary:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go test -tags testbincover -covermode count -coverpkg=antrea.io/antrea/multicluster/... -c -o bin/antrea-mc-controller-coverage antrea.io/antrea/multicluster/cmd/...
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -cover -coverpkg=antrea.io/antrea/multicluster/...,antrea.io/antrea/multicluster/cmd/... -o bin/antrea-mc-controller-coverage1 antrea.io/antrea/multicluster/cmd/...

run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go
Expand Down
1 change: 1 addition & 0 deletions multicluster/build/images/Dockerfile.build.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ LABEL description="The Docker image to deploy the Antrea Multi-cluster Controlle

USER root

RUN mkdir -p /tmp/coverage
COPY --from=antrea-build /antrea/multicluster/bin/antrea-mc-controller-coverage /
28 changes: 0 additions & 28 deletions multicluster/cmd/multicluster-controller/bincover_run_main_test.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ spec:
spec:
containers:
- command: ["/bin/sh"]
args: ["-c", "/antrea-mc-controller-coverage -test.run=TestBincoverRunMain -test.coverprofile=antrea-mc-controller.cov.out leader --config=/controller_manager_config.yaml; while true; do sleep 5 & wait $!; done"]
args: ["-c", "/antrea-mc-controller-coverage leader --config=/controller_manager_config.yaml; while true; do sleep 5 & wait $!; done"]
name: antrea-mc-controller
image: antrea/antrea-mc-controller-coverage:latest
Loading

0 comments on commit 4851993

Please sign in to comment.