From ce629384fa027d839b2bd67caa87ea85dbee99f0 Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Mon, 13 Sep 2021 16:05:08 -0700 Subject: [PATCH 01/10] removed test/ and testutil/ from code coverage --- Makefile | 5 ++++- test/nnsmockserver/nnsmock/main.go | 18 ------------------ test/nnsmockserver/nnsmockserver.go | 3 +++ test/utils/utils.go | 3 +++ testutils/netapi_mock.go | 3 +++ testutils/store_mock.go | 3 +++ 6 files changed, 16 insertions(+), 19 deletions(-) delete mode 100644 test/nnsmockserver/nnsmock/main.go diff --git a/Makefile b/Makefile index 643eff2d7b..fe6172ef62 100644 --- a/Makefile +++ b/Makefile @@ -491,9 +491,12 @@ fmt format: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm") $(GOFUMPT) -s -w $(FMT_PKG) # run all tests +# go list ./... doesn't include files tagged with 'test' or 'unit' .PHONY: test-all test-all: - go test -tags "unit" -coverpkg=./... -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... + @$(eval COVER_PKG=`go list ./... | tr '\n' ','`) + @echo Test coverpkg: $(COVER_PKG) + go test -tags "test,unit" -coverpkg=$(COVER_PKG) -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... # run all tests diff --git a/test/nnsmockserver/nnsmock/main.go b/test/nnsmockserver/nnsmock/main.go deleted file mode 100644 index 2a4582d48f..0000000000 --- a/test/nnsmockserver/nnsmock/main.go +++ /dev/null @@ -1,18 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/Azure/azure-container-networking/test/nnsmockserver" -) - -const ( - port = "6668" -) - -func main() { - fmt.Printf("starting mock nns server ....\n") - - mockserver := nnsmockserver.NewNnsMockServer() - mockserver.StartGrpcServer(port) -} diff --git a/test/nnsmockserver/nnsmockserver.go b/test/nnsmockserver/nnsmockserver.go index ddb95c70e0..5093d02ebd 100644 --- a/test/nnsmockserver/nnsmockserver.go +++ b/test/nnsmockserver/nnsmockserver.go @@ -1,3 +1,6 @@ +//go:build test +// +build test + package nnsmockserver import ( diff --git a/test/utils/utils.go b/test/utils/utils.go index 684770716d..901806858a 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -1,3 +1,6 @@ +//go:build test +// +build test + package testingutils import ( diff --git a/testutils/netapi_mock.go b/testutils/netapi_mock.go index bf3515ebfe..9d2e5b39af 100644 --- a/testutils/netapi_mock.go +++ b/testutils/netapi_mock.go @@ -1,3 +1,6 @@ +//go:build test +// +build test + package testutils type NetApiMock struct { diff --git a/testutils/store_mock.go b/testutils/store_mock.go index 03bc60ac09..67c04df6ab 100644 --- a/testutils/store_mock.go +++ b/testutils/store_mock.go @@ -1,3 +1,6 @@ +//go:build test +// +build test + package testutils import ( From cc77137d5992df61358fad440d5872db99ef73ec Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Tue, 14 Sep 2021 12:32:00 -0700 Subject: [PATCH 02/10] remove promutil from coverage --- npm/metrics/promutil/test-util.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/npm/metrics/promutil/test-util.go b/npm/metrics/promutil/test-util.go index 64a33197af..e1175f0237 100644 --- a/npm/metrics/promutil/test-util.go +++ b/npm/metrics/promutil/test-util.go @@ -1,3 +1,7 @@ +//go:build test +// +build test + +// TODO move under npm/testutils/ package promutil import "testing" @@ -12,7 +16,7 @@ func NotifyIfErrors(t *testing.T, errors ...error) { } } if !allGood { - t.Errorf("Encountered these errors while getting metric values: ") + t.Errorf("Encountered these errors while getting Prometheus metric values: ") for _, err := range errors { if err != nil { t.Errorf("%v", err) From 35e2d4dbd907e382dcc9ca78df2aa977e9bd8307 Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Mon, 13 Sep 2021 17:33:01 -0700 Subject: [PATCH 03/10] removed tools/ from code coverage --- Makefile | 6 +++--- tools/acncli/api/constants.go | 3 +++ tools/acncli/cmd/cni/cni.go | 3 +++ tools/acncli/cmd/cni/install.go | 3 +++ tools/acncli/cmd/cni/logs.go | 3 +++ tools/acncli/cmd/cni/manager.go | 3 +++ tools/acncli/cmd/install.go | 3 +++ tools/acncli/cmd/logs.go | 3 +++ tools/acncli/cmd/manager.go | 3 +++ tools/acncli/cmd/npm/get/manager.go | 3 +++ tools/acncli/cmd/npm/npm.go | 3 +++ tools/acncli/cmd/root.go | 3 +++ tools/acncli/installer/conflist.go | 3 +++ tools/acncli/installer/install.go | 3 +++ tools/acncli/installer/utils.go | 3 +++ tools/acncli/main.go | 3 +++ 16 files changed, 48 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fe6172ef62..bfd4966fe4 100644 --- a/Makefile +++ b/Makefile @@ -246,7 +246,7 @@ $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT): $(CNIFILES) # Build the Azure CLI network plugin. $(ACNCLI_BUILD_DIR)/acncli$(EXE_EXT): $(CNIFILES) - CGO_ENABLED=0 CGO_ENABLED=0 go build -v -o $(ACNCLI_BUILD_DIR)/acn$(EXE_EXT) -ldflags "-X main.version=$(VERSION)" -gcflags="-dwarflocationlists=true" $(ACNCLI_DIR)/*.go + CGO_ENABLED=0 CGO_ENABLED=0 go build --tags cli -v -o $(ACNCLI_BUILD_DIR)/acn$(EXE_EXT) -ldflags "-X main.version=$(VERSION)" -gcflags="-dwarflocationlists=true" $(ACNCLI_DIR)/*.go # Build the Azure CNS Service. $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT): $(CNSFILES) @@ -491,12 +491,12 @@ fmt format: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm") $(GOFUMPT) -s -w $(FMT_PKG) # run all tests -# go list ./... doesn't include files tagged with 'test' or 'unit' +# go list ./... doesn't include files tagged with 'test', 'cli', or 'unit' .PHONY: test-all test-all: @$(eval COVER_PKG=`go list ./... | tr '\n' ','`) @echo Test coverpkg: $(COVER_PKG) - go test -tags "test,unit" -coverpkg=$(COVER_PKG) -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... + go test -tags "test,cli,unit" -coverpkg=$(COVER_PKG) -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... # run all tests diff --git a/tools/acncli/api/constants.go b/tools/acncli/api/constants.go index 881733ff6d..0936afd659 100644 --- a/tools/acncli/api/constants.go +++ b/tools/acncli/api/constants.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package api import ( diff --git a/tools/acncli/cmd/cni/cni.go b/tools/acncli/cmd/cni/cni.go index 0f5bd7f68f..38e83ec435 100644 --- a/tools/acncli/cmd/cni/cni.go +++ b/tools/acncli/cmd/cni/cni.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package cni import ( diff --git a/tools/acncli/cmd/cni/install.go b/tools/acncli/cmd/cni/install.go index 46583269a4..db0f7ba771 100644 --- a/tools/acncli/cmd/cni/install.go +++ b/tools/acncli/cmd/cni/install.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package cni import ( diff --git a/tools/acncli/cmd/cni/logs.go b/tools/acncli/cmd/cni/logs.go index 2f0e05ba4c..7b55a7812e 100644 --- a/tools/acncli/cmd/cni/logs.go +++ b/tools/acncli/cmd/cni/logs.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package cni import ( diff --git a/tools/acncli/cmd/cni/manager.go b/tools/acncli/cmd/cni/manager.go index 9ca58fe54c..122394c6aa 100644 --- a/tools/acncli/cmd/cni/manager.go +++ b/tools/acncli/cmd/cni/manager.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package cni import ( diff --git a/tools/acncli/cmd/install.go b/tools/acncli/cmd/install.go index a4543a112e..b8c37b207f 100644 --- a/tools/acncli/cmd/install.go +++ b/tools/acncli/cmd/install.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package cmd import ( diff --git a/tools/acncli/cmd/logs.go b/tools/acncli/cmd/logs.go index 35f0caaa81..e6502f8985 100644 --- a/tools/acncli/cmd/logs.go +++ b/tools/acncli/cmd/logs.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package cmd import ( diff --git a/tools/acncli/cmd/manager.go b/tools/acncli/cmd/manager.go index 879b683c02..2e2b535d55 100644 --- a/tools/acncli/cmd/manager.go +++ b/tools/acncli/cmd/manager.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package cmd import ( diff --git a/tools/acncli/cmd/npm/get/manager.go b/tools/acncli/cmd/npm/get/manager.go index d5dfac10cc..1599665ed1 100644 --- a/tools/acncli/cmd/npm/get/manager.go +++ b/tools/acncli/cmd/npm/get/manager.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package get import ( diff --git a/tools/acncli/cmd/npm/npm.go b/tools/acncli/cmd/npm/npm.go index ea10ae1c1e..410866a7da 100644 --- a/tools/acncli/cmd/npm/npm.go +++ b/tools/acncli/cmd/npm/npm.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package npm import ( diff --git a/tools/acncli/cmd/root.go b/tools/acncli/cmd/root.go index 6b53c531df..ad6069c3ea 100644 --- a/tools/acncli/cmd/root.go +++ b/tools/acncli/cmd/root.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package cmd import ( diff --git a/tools/acncli/installer/conflist.go b/tools/acncli/installer/conflist.go index 058cb18232..5585ba5626 100644 --- a/tools/acncli/installer/conflist.go +++ b/tools/acncli/installer/conflist.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package installer import ( diff --git a/tools/acncli/installer/install.go b/tools/acncli/installer/install.go index 9de2554f3c..de7d360c6d 100644 --- a/tools/acncli/installer/install.go +++ b/tools/acncli/installer/install.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package installer import ( diff --git a/tools/acncli/installer/utils.go b/tools/acncli/installer/utils.go index 88b66db2ee..5a6bf24df0 100644 --- a/tools/acncli/installer/utils.go +++ b/tools/acncli/installer/utils.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package installer import ( diff --git a/tools/acncli/main.go b/tools/acncli/main.go index 6460023fa2..cda4dbcdbf 100644 --- a/tools/acncli/main.go +++ b/tools/acncli/main.go @@ -1,3 +1,6 @@ +//go:build cli +// +build cli + package main import ( From 69b99c54a8b4eb37320a541f8141b1b817b27a98 Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Mon, 13 Sep 2021 18:06:31 -0700 Subject: [PATCH 04/10] removed crd/ from code coverage and updated multitenantnetworkcontainer's manifest --- Makefile | 8 +- cns/Dockerfile | 2 +- crd/client.go | 3 + crd/errors.go | 3 + .../api/v1alpha1/groupversion_info.go | 3 + .../multitenantnetworkcontainer_types.go | 3 + .../api/v1alpha1/zz_generated.deepcopy.go | 1 + ...zure.com_multitenantnetworkcontainers.yaml | 155 +++++++++--------- .../api/v1alpha/groupversion_info.go | 3 + .../api/v1alpha/nodenetworkconfig.go | 3 + crd/nodenetworkconfig/client.go | 3 + crd/nodenetworkconfig/embed.go | 3 + crd/nodenetworkconfig/embed_test.go | 3 + 13 files changed, 110 insertions(+), 83 deletions(-) diff --git a/Makefile b/Makefile index bfd4966fe4..89e759ad85 100644 --- a/Makefile +++ b/Makefile @@ -250,7 +250,7 @@ $(ACNCLI_BUILD_DIR)/acncli$(EXE_EXT): $(CNIFILES) # Build the Azure CNS Service. $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT): $(CNSFILES) - CGO_ENABLED=0 go build -v -o $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT) -ldflags "-X main.version=$(VERSION) -X $(cnsaipath)=$(CNS_AI_ID)" -gcflags="-dwarflocationlists=true" $(CNS_DIR)/*.go + CGO_ENABLED=0 go build --tags crd -v -o $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT) -ldflags "-X main.version=$(VERSION) -X $(cnsaipath)=$(CNS_AI_ID)" -gcflags="-dwarflocationlists=true" $(CNS_DIR)/*.go # Build the Azure CNMS Service. $(CNMS_BUILD_DIR)/azure-cnms$(EXE_EXT): $(CNMSFILES) @@ -491,12 +491,12 @@ fmt format: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm") $(GOFUMPT) -s -w $(FMT_PKG) # run all tests -# go list ./... doesn't include files tagged with 'test', 'cli', or 'unit' +# COVER_PKG omits files tagged with 'test', 'cli', '!ignore_crd', '!ignore_autogenerated', or 'unit' .PHONY: test-all test-all: - @$(eval COVER_PKG=`go list ./... | tr '\n' ','`) + @$(eval COVER_PKG=`go list --tags ignore_crd,ignore_autogenerated ./... | tr '\n' ','`) @echo Test coverpkg: $(COVER_PKG) - go test -tags "test,cli,unit" -coverpkg=$(COVER_PKG) -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... + go test -tags "test,cli,crd,unit" -coverpkg=$(COVER_PKG) -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... # run all tests diff --git a/cns/Dockerfile b/cns/Dockerfile index 5810079b7a..c2e71f5dca 100644 --- a/cns/Dockerfile +++ b/cns/Dockerfile @@ -15,7 +15,7 @@ WORKDIR /usr/local/src/cns COPY . . # Build cns -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o /usr/local/bin/azure-cns -ldflags "-X main.version="$VERSION" -X "$CNS_AI_PATH"="$CNS_AI_ID" -s -w " cns/service/*.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --tags crd -a -o /usr/local/bin/azure-cns -ldflags "-X main.version="$VERSION" -X "$CNS_AI_PATH"="$CNS_AI_ID" -s -w " cns/service/*.go # Build aitelemetry RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o /usr/local/bin/azure-vnet-telemetry -ldflags "-X main.version="$VERSION" -s -w" cni/telemetry/service/*.go diff --git a/crd/client.go b/crd/client.go index 92dd5f4dd0..d45a1cfeab 100644 --- a/crd/client.go +++ b/crd/client.go @@ -1,3 +1,6 @@ +//go:build !ignore_crd +// +build !ignore_crd + package crd import ( diff --git a/crd/errors.go b/crd/errors.go index c41e32bf64..f9e7b01ae7 100644 --- a/crd/errors.go +++ b/crd/errors.go @@ -1,3 +1,6 @@ +//go:build !ignore_crd +// +build !ignore_crd + package crd import ( diff --git a/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go b/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go index 7d203c0a43..e6cac8bf3e 100644 --- a/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go +++ b/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go @@ -1,3 +1,6 @@ +//go:build !ignore_crd +// +build !ignore_crd + // Package v1alpha1 contains API Schema definitions for the networking v1alpha1 API group // +kubebuilder:object:generate=true // +groupName=networking.azure.com diff --git a/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go b/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go index 49eb64a37a..7658dcd9d2 100644 --- a/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go +++ b/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go @@ -1,3 +1,6 @@ +//go:build !ignore_crd +// +build !ignore_crd + package v1alpha1 import ( diff --git a/crd/multitenantnetworkcontainer/api/v1alpha1/zz_generated.deepcopy.go b/crd/multitenantnetworkcontainer/api/v1alpha1/zz_generated.deepcopy.go index 6613aa64c9..8990e68324 100644 --- a/crd/multitenantnetworkcontainer/api/v1alpha1/zz_generated.deepcopy.go +++ b/crd/multitenantnetworkcontainer/api/v1alpha1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated // Code generated by controller-gen. DO NOT EDIT. diff --git a/crd/multitenantnetworkcontainer/manifests/networking.azure.com_multitenantnetworkcontainers.yaml b/crd/multitenantnetworkcontainer/manifests/networking.azure.com_multitenantnetworkcontainers.yaml index 43329fcbde..055cacd462 100644 --- a/crd/multitenantnetworkcontainer/manifests/networking.azure.com_multitenantnetworkcontainers.yaml +++ b/crd/multitenantnetworkcontainer/manifests/networking.azure.com_multitenantnetworkcontainers.yaml @@ -1,10 +1,10 @@ --- -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.3.0 + controller-gen.kubebuilder.io/version: v0.6.2 creationTimestamp: null name: multitenantnetworkcontainers.networking.azure.com spec: @@ -15,86 +15,85 @@ spec: plural: multitenantnetworkcontainers singular: multitenantnetworkcontainer scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - description: MultiTenantNetworkContainer is the Schema for the MultiTenantnetworkcontainers - API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: MultiTenantNetworkContainerSpec defines the desired state of - MultiTenantNetworkContainer - properties: - interfaceName: - description: InterfaceName - the interface name for consuming Pod - type: string - network: - description: Network - customer VNet GUID - type: string - node: - description: Node - kubernetes node name - type: string - reservationID: - description: ReservationID - reservation ID for allocating IP - type: string - subnet: - description: Subnet - customer subnet name - type: string - uuid: - description: UUID - network container UUID - type: string - type: object - status: - description: MultiTenantNetworkContainerStatus defines the observed state - of MultiTenantNetworkContainer - properties: - gateway: - description: The gateway IP address - type: string - ip: - description: The IP address - type: string - ipSubnet: - description: The subnet CIDR - type: string - multiTenantInfo: - description: MultiTenantInfo holds the encap type and id - properties: - encapType: - description: EncapType is type of encapsulation - type: string - id: - description: ID of encapsulation, can be vlanid, vxlanid, gre-key, - etc depending on EncapType - format: int64 - type: integer - type: object - primaryInterfaceIdentifier: - description: The primary interface identifier - type: string - state: - description: The state of network container - type: string - type: object - type: object - version: v1alpha1 versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: MultiTenantNetworkContainer is the Schema for the MultiTenantnetworkcontainers + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: MultiTenantNetworkContainerSpec defines the desired state + of MultiTenantNetworkContainer + properties: + interfaceName: + description: InterfaceName - the interface name for consuming Pod + type: string + network: + description: Network - customer VNet GUID + type: string + node: + description: Node - kubernetes node name + type: string + reservationID: + description: ReservationID - reservation ID for allocating IP + type: string + subnet: + description: Subnet - customer subnet name + type: string + uuid: + description: UUID - network container UUID + type: string + type: object + status: + description: MultiTenantNetworkContainerStatus defines the observed state + of MultiTenantNetworkContainer + properties: + gateway: + description: The gateway IP address + type: string + ip: + description: The IP address + type: string + ipSubnet: + description: The subnet CIDR + type: string + multiTenantInfo: + description: MultiTenantInfo holds the encap type and id + properties: + encapType: + description: EncapType is type of encapsulation + type: string + id: + description: ID of encapsulation, can be vlanid, vxlanid, gre-key, + etc depending on EncapType + format: int64 + type: integer + type: object + primaryInterfaceIdentifier: + description: The primary interface identifier + type: string + state: + description: The state of network container + type: string + type: object + type: object served: true storage: true + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go b/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go index 0fa88609d8..7a677eceec 100644 --- a/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go +++ b/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go @@ -1,3 +1,6 @@ +//go:build !ignore_crd +// +build !ignore_crd + // Package v1alpha contains API Schema definitions for the acn v1alpha API group // +kubebuilder:object:generate=true // +groupName=acn.azure.com diff --git a/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go b/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go index 727e14e0cf..94a34d1430 100644 --- a/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go +++ b/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go @@ -1,3 +1,6 @@ +//go:build !ignore_crd +// +build !ignore_crd + package v1alpha import ( diff --git a/crd/nodenetworkconfig/client.go b/crd/nodenetworkconfig/client.go index e588d89652..56ac798302 100644 --- a/crd/nodenetworkconfig/client.go +++ b/crd/nodenetworkconfig/client.go @@ -1,3 +1,6 @@ +//go:build !ignore_crd +// +build !ignore_crd + package nodenetworkconfig import ( diff --git a/crd/nodenetworkconfig/embed.go b/crd/nodenetworkconfig/embed.go index 0da7837287..f6229eaf3f 100644 --- a/crd/nodenetworkconfig/embed.go +++ b/crd/nodenetworkconfig/embed.go @@ -1,3 +1,6 @@ +//go:build !ignore_crd +// +build !ignore_crd + package nodenetworkconfig import ( diff --git a/crd/nodenetworkconfig/embed_test.go b/crd/nodenetworkconfig/embed_test.go index 0fda4d23e4..996f7276b0 100644 --- a/crd/nodenetworkconfig/embed_test.go +++ b/crd/nodenetworkconfig/embed_test.go @@ -1,3 +1,6 @@ +//go:build !ignore_crd +// +build !ignore_crd + package nodenetworkconfig import ( From 00b514176d0e8b364c935816dbbc109af5064396 Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Tue, 14 Sep 2021 16:38:20 -0700 Subject: [PATCH 05/10] switch to !ignore_NAME syntax for test and cli tags --- Makefile | 10 +++++----- cns/Dockerfile | 2 +- npm/metrics/promutil/test-util.go | 5 ++--- test/nnsmockserver/nnsmockserver.go | 4 ++-- test/utils/utils.go | 4 ++-- testutils/netapi_mock.go | 4 ++-- testutils/store_mock.go | 4 ++-- tools/acncli/api/constants.go | 4 ++-- tools/acncli/cmd/cni/cni.go | 4 ++-- tools/acncli/cmd/cni/install.go | 4 ++-- tools/acncli/cmd/cni/logs.go | 4 ++-- tools/acncli/cmd/cni/manager.go | 4 ++-- tools/acncli/cmd/install.go | 4 ++-- tools/acncli/cmd/logs.go | 4 ++-- tools/acncli/cmd/manager.go | 4 ++-- tools/acncli/cmd/npm/get/manager.go | 4 ++-- tools/acncli/cmd/npm/npm.go | 4 ++-- tools/acncli/cmd/root.go | 4 ++-- tools/acncli/installer/conflist.go | 4 ++-- tools/acncli/installer/install.go | 4 ++-- tools/acncli/installer/utils.go | 4 ++-- tools/acncli/main.go | 4 ++-- 22 files changed, 46 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 89e759ad85..6873b9a021 100644 --- a/Makefile +++ b/Makefile @@ -246,11 +246,11 @@ $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT): $(CNIFILES) # Build the Azure CLI network plugin. $(ACNCLI_BUILD_DIR)/acncli$(EXE_EXT): $(CNIFILES) - CGO_ENABLED=0 CGO_ENABLED=0 go build --tags cli -v -o $(ACNCLI_BUILD_DIR)/acn$(EXE_EXT) -ldflags "-X main.version=$(VERSION)" -gcflags="-dwarflocationlists=true" $(ACNCLI_DIR)/*.go + CGO_ENABLED=0 CGO_ENABLED=0 go build -v -o $(ACNCLI_BUILD_DIR)/acn$(EXE_EXT) -ldflags "-X main.version=$(VERSION)" -gcflags="-dwarflocationlists=true" $(ACNCLI_DIR)/*.go # Build the Azure CNS Service. $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT): $(CNSFILES) - CGO_ENABLED=0 go build --tags crd -v -o $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT) -ldflags "-X main.version=$(VERSION) -X $(cnsaipath)=$(CNS_AI_ID)" -gcflags="-dwarflocationlists=true" $(CNS_DIR)/*.go + CGO_ENABLED=0 go build -v -o $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT) -ldflags "-X main.version=$(VERSION) -X $(cnsaipath)=$(CNS_AI_ID)" -gcflags="-dwarflocationlists=true" $(CNS_DIR)/*.go # Build the Azure CNMS Service. $(CNMS_BUILD_DIR)/azure-cnms$(EXE_EXT): $(CNMSFILES) @@ -491,12 +491,12 @@ fmt format: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm") $(GOFUMPT) -s -w $(FMT_PKG) # run all tests -# COVER_PKG omits files tagged with 'test', 'cli', '!ignore_crd', '!ignore_autogenerated', or 'unit' +# COVER_PKG omits folders with all files tagged with one of 'unit', '!ignore_test', '!ignore_cli', '!ignore_crd', or '!ignore_autogenerated' .PHONY: test-all test-all: - @$(eval COVER_PKG=`go list --tags ignore_crd,ignore_autogenerated ./... | tr '\n' ','`) + @$(eval COVER_PKG=`go list --tags ignore_test,ignore_cli,ignore_crd,ignore_autogenerated ./... | tr '\n' ','`) @echo Test coverpkg: $(COVER_PKG) - go test -tags "test,cli,crd,unit" -coverpkg=$(COVER_PKG) -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... + go test -tags "unit" -coverpkg=$(COVER_PKG) -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... # run all tests diff --git a/cns/Dockerfile b/cns/Dockerfile index c2e71f5dca..5810079b7a 100644 --- a/cns/Dockerfile +++ b/cns/Dockerfile @@ -15,7 +15,7 @@ WORKDIR /usr/local/src/cns COPY . . # Build cns -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --tags crd -a -o /usr/local/bin/azure-cns -ldflags "-X main.version="$VERSION" -X "$CNS_AI_PATH"="$CNS_AI_ID" -s -w " cns/service/*.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o /usr/local/bin/azure-cns -ldflags "-X main.version="$VERSION" -X "$CNS_AI_PATH"="$CNS_AI_ID" -s -w " cns/service/*.go # Build aitelemetry RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o /usr/local/bin/azure-vnet-telemetry -ldflags "-X main.version="$VERSION" -s -w" cni/telemetry/service/*.go diff --git a/npm/metrics/promutil/test-util.go b/npm/metrics/promutil/test-util.go index e1175f0237..5793ad2ca4 100644 --- a/npm/metrics/promutil/test-util.go +++ b/npm/metrics/promutil/test-util.go @@ -1,7 +1,6 @@ -//go:build test -// +build test +//go:build !ignore_test +// +build !ignore_test -// TODO move under npm/testutils/ package promutil import "testing" diff --git a/test/nnsmockserver/nnsmockserver.go b/test/nnsmockserver/nnsmockserver.go index 5093d02ebd..373e8dcef5 100644 --- a/test/nnsmockserver/nnsmockserver.go +++ b/test/nnsmockserver/nnsmockserver.go @@ -1,5 +1,5 @@ -//go:build test -// +build test +//go:build !ignore_test +// +build !ignore_test package nnsmockserver diff --git a/test/utils/utils.go b/test/utils/utils.go index 901806858a..655f800504 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -1,5 +1,5 @@ -//go:build test -// +build test +//go:build !ignore_test +// +build !ignore_test package testingutils diff --git a/testutils/netapi_mock.go b/testutils/netapi_mock.go index 9d2e5b39af..3307f1211f 100644 --- a/testutils/netapi_mock.go +++ b/testutils/netapi_mock.go @@ -1,5 +1,5 @@ -//go:build test -// +build test +//go:build !ignore_test +// +build !ignore_test package testutils diff --git a/testutils/store_mock.go b/testutils/store_mock.go index 67c04df6ab..4c3fd444f2 100644 --- a/testutils/store_mock.go +++ b/testutils/store_mock.go @@ -1,5 +1,5 @@ -//go:build test -// +build test +//go:build !ignore_test +// +build !ignore_test package testutils diff --git a/tools/acncli/api/constants.go b/tools/acncli/api/constants.go index 0936afd659..ef162017b9 100644 --- a/tools/acncli/api/constants.go +++ b/tools/acncli/api/constants.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package api diff --git a/tools/acncli/cmd/cni/cni.go b/tools/acncli/cmd/cni/cni.go index 38e83ec435..d3a9cfe68d 100644 --- a/tools/acncli/cmd/cni/cni.go +++ b/tools/acncli/cmd/cni/cni.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package cni diff --git a/tools/acncli/cmd/cni/install.go b/tools/acncli/cmd/cni/install.go index db0f7ba771..d7d3055f9a 100644 --- a/tools/acncli/cmd/cni/install.go +++ b/tools/acncli/cmd/cni/install.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package cni diff --git a/tools/acncli/cmd/cni/logs.go b/tools/acncli/cmd/cni/logs.go index 7b55a7812e..1c7762cf24 100644 --- a/tools/acncli/cmd/cni/logs.go +++ b/tools/acncli/cmd/cni/logs.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package cni diff --git a/tools/acncli/cmd/cni/manager.go b/tools/acncli/cmd/cni/manager.go index 122394c6aa..b0b24c49a0 100644 --- a/tools/acncli/cmd/cni/manager.go +++ b/tools/acncli/cmd/cni/manager.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package cni diff --git a/tools/acncli/cmd/install.go b/tools/acncli/cmd/install.go index b8c37b207f..04b019e0d7 100644 --- a/tools/acncli/cmd/install.go +++ b/tools/acncli/cmd/install.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package cmd diff --git a/tools/acncli/cmd/logs.go b/tools/acncli/cmd/logs.go index e6502f8985..b690d22358 100644 --- a/tools/acncli/cmd/logs.go +++ b/tools/acncli/cmd/logs.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package cmd diff --git a/tools/acncli/cmd/manager.go b/tools/acncli/cmd/manager.go index 2e2b535d55..4ac08c2367 100644 --- a/tools/acncli/cmd/manager.go +++ b/tools/acncli/cmd/manager.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package cmd diff --git a/tools/acncli/cmd/npm/get/manager.go b/tools/acncli/cmd/npm/get/manager.go index 1599665ed1..76567078d3 100644 --- a/tools/acncli/cmd/npm/get/manager.go +++ b/tools/acncli/cmd/npm/get/manager.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package get diff --git a/tools/acncli/cmd/npm/npm.go b/tools/acncli/cmd/npm/npm.go index 410866a7da..55a4bdd12f 100644 --- a/tools/acncli/cmd/npm/npm.go +++ b/tools/acncli/cmd/npm/npm.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package npm diff --git a/tools/acncli/cmd/root.go b/tools/acncli/cmd/root.go index ad6069c3ea..c0f2d20bc9 100644 --- a/tools/acncli/cmd/root.go +++ b/tools/acncli/cmd/root.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package cmd diff --git a/tools/acncli/installer/conflist.go b/tools/acncli/installer/conflist.go index 5585ba5626..a8e1bf4ab8 100644 --- a/tools/acncli/installer/conflist.go +++ b/tools/acncli/installer/conflist.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package installer diff --git a/tools/acncli/installer/install.go b/tools/acncli/installer/install.go index de7d360c6d..9addb82d48 100644 --- a/tools/acncli/installer/install.go +++ b/tools/acncli/installer/install.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package installer diff --git a/tools/acncli/installer/utils.go b/tools/acncli/installer/utils.go index 5a6bf24df0..3617cc14d1 100644 --- a/tools/acncli/installer/utils.go +++ b/tools/acncli/installer/utils.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package installer diff --git a/tools/acncli/main.go b/tools/acncli/main.go index cda4dbcdbf..67e8039452 100644 --- a/tools/acncli/main.go +++ b/tools/acncli/main.go @@ -1,5 +1,5 @@ -//go:build cli -// +build cli +//go:build !ignore_cli +// +build !ignore_cli package main From a9412f1514596bded2f41fb1cbaa80116df94ebf Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Wed, 15 Sep 2021 11:40:01 -0700 Subject: [PATCH 06/10] add coverage back to crd (besides autogenerated files) --- Makefile | 4 ++-- crd/client.go | 3 --- crd/errors.go | 3 --- .../api/v1alpha1/groupversion_info.go | 3 --- .../api/v1alpha1/multitenantnetworkcontainer_types.go | 3 --- crd/nodenetworkconfig/api/v1alpha/groupversion_info.go | 3 --- crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go | 3 --- crd/nodenetworkconfig/client.go | 3 --- crd/nodenetworkconfig/embed.go | 3 --- crd/nodenetworkconfig/embed_test.go | 3 --- 10 files changed, 2 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 6873b9a021..34f5164e5a 100644 --- a/Makefile +++ b/Makefile @@ -491,10 +491,10 @@ fmt format: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm") $(GOFUMPT) -s -w $(FMT_PKG) # run all tests -# COVER_PKG omits folders with all files tagged with one of 'unit', '!ignore_test', '!ignore_cli', '!ignore_crd', or '!ignore_autogenerated' +# COVER_PKG omits folders with all files tagged with one of 'unit', '!ignore_test', '!ignore_cli', or '!ignore_autogenerated' .PHONY: test-all test-all: - @$(eval COVER_PKG=`go list --tags ignore_test,ignore_cli,ignore_crd,ignore_autogenerated ./... | tr '\n' ','`) + @$(eval COVER_PKG=`go list --tags ignore_test,ignore_cli,ignore_autogenerated ./... | tr '\n' ','`) @echo Test coverpkg: $(COVER_PKG) go test -tags "unit" -coverpkg=$(COVER_PKG) -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... diff --git a/crd/client.go b/crd/client.go index d45a1cfeab..92dd5f4dd0 100644 --- a/crd/client.go +++ b/crd/client.go @@ -1,6 +1,3 @@ -//go:build !ignore_crd -// +build !ignore_crd - package crd import ( diff --git a/crd/errors.go b/crd/errors.go index f9e7b01ae7..c41e32bf64 100644 --- a/crd/errors.go +++ b/crd/errors.go @@ -1,6 +1,3 @@ -//go:build !ignore_crd -// +build !ignore_crd - package crd import ( diff --git a/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go b/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go index e6cac8bf3e..7d203c0a43 100644 --- a/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go +++ b/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go @@ -1,6 +1,3 @@ -//go:build !ignore_crd -// +build !ignore_crd - // Package v1alpha1 contains API Schema definitions for the networking v1alpha1 API group // +kubebuilder:object:generate=true // +groupName=networking.azure.com diff --git a/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go b/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go index 7658dcd9d2..49eb64a37a 100644 --- a/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go +++ b/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go @@ -1,6 +1,3 @@ -//go:build !ignore_crd -// +build !ignore_crd - package v1alpha1 import ( diff --git a/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go b/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go index 7a677eceec..0fa88609d8 100644 --- a/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go +++ b/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go @@ -1,6 +1,3 @@ -//go:build !ignore_crd -// +build !ignore_crd - // Package v1alpha contains API Schema definitions for the acn v1alpha API group // +kubebuilder:object:generate=true // +groupName=acn.azure.com diff --git a/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go b/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go index 94a34d1430..727e14e0cf 100644 --- a/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go +++ b/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go @@ -1,6 +1,3 @@ -//go:build !ignore_crd -// +build !ignore_crd - package v1alpha import ( diff --git a/crd/nodenetworkconfig/client.go b/crd/nodenetworkconfig/client.go index 56ac798302..e588d89652 100644 --- a/crd/nodenetworkconfig/client.go +++ b/crd/nodenetworkconfig/client.go @@ -1,6 +1,3 @@ -//go:build !ignore_crd -// +build !ignore_crd - package nodenetworkconfig import ( diff --git a/crd/nodenetworkconfig/embed.go b/crd/nodenetworkconfig/embed.go index f6229eaf3f..0da7837287 100644 --- a/crd/nodenetworkconfig/embed.go +++ b/crd/nodenetworkconfig/embed.go @@ -1,6 +1,3 @@ -//go:build !ignore_crd -// +build !ignore_crd - package nodenetworkconfig import ( diff --git a/crd/nodenetworkconfig/embed_test.go b/crd/nodenetworkconfig/embed_test.go index 996f7276b0..0fda4d23e4 100644 --- a/crd/nodenetworkconfig/embed_test.go +++ b/crd/nodenetworkconfig/embed_test.go @@ -1,6 +1,3 @@ -//go:build !ignore_crd -// +build !ignore_crd - package nodenetworkconfig import ( From 4a3d2da352f3c3d5981886899d531e564a7688c0 Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Wed, 15 Sep 2021 11:42:01 -0700 Subject: [PATCH 07/10] rename ignore_test and ignore_cli tags to ignore_uncovered --- Makefile | 4 ++-- npm/metrics/promutil/test-util.go | 4 ++-- test/nnsmockserver/nnsmockserver.go | 4 ++-- test/utils/utils.go | 4 ++-- testutils/netapi_mock.go | 4 ++-- testutils/store_mock.go | 4 ++-- tools/acncli/api/constants.go | 4 ++-- tools/acncli/cmd/cni/cni.go | 4 ++-- tools/acncli/cmd/cni/install.go | 4 ++-- tools/acncli/cmd/cni/logs.go | 4 ++-- tools/acncli/cmd/cni/manager.go | 4 ++-- tools/acncli/cmd/install.go | 4 ++-- tools/acncli/cmd/logs.go | 4 ++-- tools/acncli/cmd/manager.go | 4 ++-- tools/acncli/cmd/npm/get/manager.go | 4 ++-- tools/acncli/cmd/npm/npm.go | 4 ++-- tools/acncli/cmd/root.go | 4 ++-- tools/acncli/installer/conflist.go | 4 ++-- tools/acncli/installer/install.go | 4 ++-- tools/acncli/installer/utils.go | 4 ++-- tools/acncli/main.go | 4 ++-- 21 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 34f5164e5a..0c08ad5493 100644 --- a/Makefile +++ b/Makefile @@ -491,10 +491,10 @@ fmt format: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm") $(GOFUMPT) -s -w $(FMT_PKG) # run all tests -# COVER_PKG omits folders with all files tagged with one of 'unit', '!ignore_test', '!ignore_cli', or '!ignore_autogenerated' +# COVER_PKG omits folders with all files tagged with one of 'unit', '!ignore_uncovered', or '!ignore_autogenerated' .PHONY: test-all test-all: - @$(eval COVER_PKG=`go list --tags ignore_test,ignore_cli,ignore_autogenerated ./... | tr '\n' ','`) + @$(eval COVER_PKG=`go list --tags ignore_uncovered,ignore_autogenerated ./... | tr '\n' ','`) @echo Test coverpkg: $(COVER_PKG) go test -tags "unit" -coverpkg=$(COVER_PKG) -v -race -covermode atomic -failfast -coverprofile=coverage.out ./... diff --git a/npm/metrics/promutil/test-util.go b/npm/metrics/promutil/test-util.go index 5793ad2ca4..1644b5eac5 100644 --- a/npm/metrics/promutil/test-util.go +++ b/npm/metrics/promutil/test-util.go @@ -1,5 +1,5 @@ -//go:build !ignore_test -// +build !ignore_test +//go:build !ignore_uncovered +// +build !ignore_uncovered package promutil diff --git a/test/nnsmockserver/nnsmockserver.go b/test/nnsmockserver/nnsmockserver.go index 373e8dcef5..e373041c60 100644 --- a/test/nnsmockserver/nnsmockserver.go +++ b/test/nnsmockserver/nnsmockserver.go @@ -1,5 +1,5 @@ -//go:build !ignore_test -// +build !ignore_test +//go:build !ignore_uncovered +// +build !ignore_uncovered package nnsmockserver diff --git a/test/utils/utils.go b/test/utils/utils.go index 655f800504..8909abd8d7 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -1,5 +1,5 @@ -//go:build !ignore_test -// +build !ignore_test +//go:build !ignore_uncovered +// +build !ignore_uncovered package testingutils diff --git a/testutils/netapi_mock.go b/testutils/netapi_mock.go index 3307f1211f..3e93e452dd 100644 --- a/testutils/netapi_mock.go +++ b/testutils/netapi_mock.go @@ -1,5 +1,5 @@ -//go:build !ignore_test -// +build !ignore_test +//go:build !ignore_uncovered +// +build !ignore_uncovered package testutils diff --git a/testutils/store_mock.go b/testutils/store_mock.go index 4c3fd444f2..c626907c0a 100644 --- a/testutils/store_mock.go +++ b/testutils/store_mock.go @@ -1,5 +1,5 @@ -//go:build !ignore_test -// +build !ignore_test +//go:build !ignore_uncovered +// +build !ignore_uncovered package testutils diff --git a/tools/acncli/api/constants.go b/tools/acncli/api/constants.go index ef162017b9..731e1f34d9 100644 --- a/tools/acncli/api/constants.go +++ b/tools/acncli/api/constants.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package api diff --git a/tools/acncli/cmd/cni/cni.go b/tools/acncli/cmd/cni/cni.go index d3a9cfe68d..9b5782b44a 100644 --- a/tools/acncli/cmd/cni/cni.go +++ b/tools/acncli/cmd/cni/cni.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package cni diff --git a/tools/acncli/cmd/cni/install.go b/tools/acncli/cmd/cni/install.go index d7d3055f9a..caa26be718 100644 --- a/tools/acncli/cmd/cni/install.go +++ b/tools/acncli/cmd/cni/install.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package cni diff --git a/tools/acncli/cmd/cni/logs.go b/tools/acncli/cmd/cni/logs.go index 1c7762cf24..3f0573d4ff 100644 --- a/tools/acncli/cmd/cni/logs.go +++ b/tools/acncli/cmd/cni/logs.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package cni diff --git a/tools/acncli/cmd/cni/manager.go b/tools/acncli/cmd/cni/manager.go index b0b24c49a0..06289d9322 100644 --- a/tools/acncli/cmd/cni/manager.go +++ b/tools/acncli/cmd/cni/manager.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package cni diff --git a/tools/acncli/cmd/install.go b/tools/acncli/cmd/install.go index 04b019e0d7..88c75de92d 100644 --- a/tools/acncli/cmd/install.go +++ b/tools/acncli/cmd/install.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package cmd diff --git a/tools/acncli/cmd/logs.go b/tools/acncli/cmd/logs.go index b690d22358..d56153504d 100644 --- a/tools/acncli/cmd/logs.go +++ b/tools/acncli/cmd/logs.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package cmd diff --git a/tools/acncli/cmd/manager.go b/tools/acncli/cmd/manager.go index 4ac08c2367..08717b70dd 100644 --- a/tools/acncli/cmd/manager.go +++ b/tools/acncli/cmd/manager.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package cmd diff --git a/tools/acncli/cmd/npm/get/manager.go b/tools/acncli/cmd/npm/get/manager.go index 76567078d3..c6fc78b6ac 100644 --- a/tools/acncli/cmd/npm/get/manager.go +++ b/tools/acncli/cmd/npm/get/manager.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package get diff --git a/tools/acncli/cmd/npm/npm.go b/tools/acncli/cmd/npm/npm.go index 55a4bdd12f..67f69f6f9c 100644 --- a/tools/acncli/cmd/npm/npm.go +++ b/tools/acncli/cmd/npm/npm.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package npm diff --git a/tools/acncli/cmd/root.go b/tools/acncli/cmd/root.go index c0f2d20bc9..ee653de695 100644 --- a/tools/acncli/cmd/root.go +++ b/tools/acncli/cmd/root.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package cmd diff --git a/tools/acncli/installer/conflist.go b/tools/acncli/installer/conflist.go index a8e1bf4ab8..5de17c0245 100644 --- a/tools/acncli/installer/conflist.go +++ b/tools/acncli/installer/conflist.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package installer diff --git a/tools/acncli/installer/install.go b/tools/acncli/installer/install.go index 9addb82d48..c562373461 100644 --- a/tools/acncli/installer/install.go +++ b/tools/acncli/installer/install.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package installer diff --git a/tools/acncli/installer/utils.go b/tools/acncli/installer/utils.go index 3617cc14d1..e871a5643d 100644 --- a/tools/acncli/installer/utils.go +++ b/tools/acncli/installer/utils.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package installer diff --git a/tools/acncli/main.go b/tools/acncli/main.go index 67e8039452..72336fb49a 100644 --- a/tools/acncli/main.go +++ b/tools/acncli/main.go @@ -1,5 +1,5 @@ -//go:build !ignore_cli -// +build !ignore_cli +//go:build !ignore_uncovered +// +build !ignore_uncovered package main From b97648bb52e174ac2cd9275fa228e2d3d5c3cfcb Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Wed, 15 Sep 2021 11:43:52 -0700 Subject: [PATCH 08/10] make cns/fakes/ uncovered --- cns/fakes/cnsfake.go | 3 +++ cns/fakes/imdsclientfake.go | 3 +++ cns/fakes/ipampoolmonitorfake.go | 3 +++ cns/fakes/nmagentclientfake.go | 3 +++ cns/fakes/requestcontrollerfake.go | 3 +++ 5 files changed, 15 insertions(+) diff --git a/cns/fakes/cnsfake.go b/cns/fakes/cnsfake.go index 41c0404218..1c86d1cd2b 100644 --- a/cns/fakes/cnsfake.go +++ b/cns/fakes/cnsfake.go @@ -1,3 +1,6 @@ +//go:build !ignore_uncovered +// +build !ignore_uncovered + package fakes import ( diff --git a/cns/fakes/imdsclientfake.go b/cns/fakes/imdsclientfake.go index 70d51db81c..68f1eda639 100644 --- a/cns/fakes/imdsclientfake.go +++ b/cns/fakes/imdsclientfake.go @@ -1,3 +1,6 @@ +//go:build !ignore_uncovered +// +build !ignore_uncovered + // Copyright 2017 Microsoft. All rights reserved. // MIT License diff --git a/cns/fakes/ipampoolmonitorfake.go b/cns/fakes/ipampoolmonitorfake.go index 8fec88155b..adde22342a 100644 --- a/cns/fakes/ipampoolmonitorfake.go +++ b/cns/fakes/ipampoolmonitorfake.go @@ -1,3 +1,6 @@ +//go:build !ignore_uncovered +// +build !ignore_uncovered + package fakes import ( diff --git a/cns/fakes/nmagentclientfake.go b/cns/fakes/nmagentclientfake.go index 5bfa9b523e..751159f44b 100644 --- a/cns/fakes/nmagentclientfake.go +++ b/cns/fakes/nmagentclientfake.go @@ -1,3 +1,6 @@ +//go:build !ignore_uncovered +// +build !ignore_uncovered + // Copyright 2020 Microsoft. All rights reserved. // MIT License diff --git a/cns/fakes/requestcontrollerfake.go b/cns/fakes/requestcontrollerfake.go index daa2fd853a..bacc369dfb 100644 --- a/cns/fakes/requestcontrollerfake.go +++ b/cns/fakes/requestcontrollerfake.go @@ -1,3 +1,6 @@ +//go:build !ignore_uncovered +// +build !ignore_uncovered + package fakes import ( From fc972bbfb7b3c479280ddcf8f475aedff5c1a1db Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Wed, 15 Sep 2021 12:10:40 -0700 Subject: [PATCH 09/10] mark go files in crd api folders as uncovered again --- .../api/v1alpha1/groupversion_info.go | 3 +++ .../api/v1alpha1/multitenantnetworkcontainer_types.go | 3 +++ crd/nodenetworkconfig/api/v1alpha/groupversion_info.go | 3 +++ crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go | 3 +++ 4 files changed, 12 insertions(+) diff --git a/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go b/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go index 7d203c0a43..7c5416b523 100644 --- a/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go +++ b/crd/multitenantnetworkcontainer/api/v1alpha1/groupversion_info.go @@ -1,3 +1,6 @@ +//go:build !ignore_uncovered +// +build !ignore_uncovered + // Package v1alpha1 contains API Schema definitions for the networking v1alpha1 API group // +kubebuilder:object:generate=true // +groupName=networking.azure.com diff --git a/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go b/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go index 49eb64a37a..3f53fafc66 100644 --- a/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go +++ b/crd/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go @@ -1,3 +1,6 @@ +//go:build !ignore_uncovered +// +build !ignore_uncovered + package v1alpha1 import ( diff --git a/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go b/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go index 0fa88609d8..ecf249a821 100644 --- a/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go +++ b/crd/nodenetworkconfig/api/v1alpha/groupversion_info.go @@ -1,3 +1,6 @@ +//go:build !ignore_uncovered +// +build !ignore_uncovered + // Package v1alpha contains API Schema definitions for the acn v1alpha API group // +kubebuilder:object:generate=true // +groupName=acn.azure.com diff --git a/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go b/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go index 727e14e0cf..6c89aff4df 100644 --- a/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go +++ b/crd/nodenetworkconfig/api/v1alpha/nodenetworkconfig.go @@ -1,3 +1,6 @@ +//go:build !ignore_uncovered +// +build !ignore_uncovered + package v1alpha import ( From 5f30e6fa4a2cd02f5762a0e2e7be2b5bb362ed9c Mon Sep 17 00:00:00 2001 From: Hunter Gregory Date: Wed, 15 Sep 2021 14:44:18 -0700 Subject: [PATCH 10/10] add main.go back for nnsmock server --- test/nnsmockserver/nnsmock/main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/nnsmockserver/nnsmock/main.go diff --git a/test/nnsmockserver/nnsmock/main.go b/test/nnsmockserver/nnsmock/main.go new file mode 100644 index 0000000000..2a4582d48f --- /dev/null +++ b/test/nnsmockserver/nnsmock/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + + "github.com/Azure/azure-container-networking/test/nnsmockserver" +) + +const ( + port = "6668" +) + +func main() { + fmt.Printf("starting mock nns server ....\n") + + mockserver := nnsmockserver.NewNnsMockServer() + mockserver.StartGrpcServer(port) +}