-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload multi-cluster e2e coverage to codecov (#3942)
1. Add a new target on Makefile to build multi-cluster controller image with the instrumented binary. 2. Add steps on test-mc.sh to collect coverage files from leader and member cluster controllers and upload them to codecov. Signed-off-by: Lan Luo <luola@vmware.com>
- Loading branch information
1 parent
79b6480
commit 6bbdb2a
Showing
9 changed files
with
197 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ARG GO_VERSION | ||
FROM golang:${GO_VERSION} as antrea-build | ||
|
||
WORKDIR /antrea | ||
|
||
COPY go.mod /antrea/go.mod | ||
|
||
RUN go mod download | ||
|
||
COPY . /antrea | ||
|
||
RUN cd multicluster && make antrea-mc-instr-binary | ||
|
||
FROM ubuntu:20.04 | ||
|
||
LABEL maintainer="Antrea <projectantrea-dev@googlegroups.com>" | ||
LABEL description="The Docker image to deploy the Antrea Multicluster controller with code coverage measurement enabled (used for testing)." | ||
|
||
USER root | ||
|
||
COPY --from=antrea-build /antrea/multicluster/bin/antrea-mc-controller-coverage / |
28 changes: 28 additions & 0 deletions
28
multicluster/cmd/multicluster-controller/bincover_run_main_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2022 Antrea Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//go:build testbincover | ||
// +build testbincover | ||
|
||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/confluentinc/bincover" | ||
) | ||
|
||
func TestBincoverRunMain(t *testing.T) { | ||
bincover.RunTest(main) | ||
} |
13 changes: 13 additions & 0 deletions
13
multicluster/config/overlays/leader-ns/coverage/manager_command_patch_coverage.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller | ||
namespace: system | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- command: ["/bin/sh"] | ||
args: ["-c", "/antrea-mc-controller-coverage -test.run=TestBincoverRunMain -test.coverprofile=antrea-mc-controller.cov.out leader; while true; do sleep 5 & wait $!; done"] | ||
name: antrea-mc-controller | ||
image: projects.registry.vmware.com/antrea/antrea-mc-controller-coverage:latest |
13 changes: 13 additions & 0 deletions
13
multicluster/config/overlays/member/coverage/manager_command_patch_coverage.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller | ||
namespace: system | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- command: ["/bin/sh"] | ||
args: ["-c", "/antrea-mc-controller-coverage -test.run=TestBincoverRunMain -test.coverprofile=antrea-mc-controller.cov.out member; while true; do sleep 5 & wait $!; done"] | ||
name: antrea-mc-controller | ||
image: projects.registry.vmware.com/antrea/antrea-mc-controller-coverage:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters