diff --git a/.golangci.yml b/.golangci.yml index 9cf666707..6fea0ffeb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -122,6 +122,6 @@ issues: # golangci.com configuration # https://github.com/golangci/golangci/wiki/Configuration service: - golangci-lint-version: 1.47.x # use the fixed version to not introduce new linters unexpectedly + golangci-lint-version: 1.48.x # use the fixed version to not introduce new linters unexpectedly prepare: - echo "here I can run custom commands, but no preparation needed for this repo" diff --git a/Makefile b/Makefile index af9ba19f7..dab5fb089 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ COMMON_GO_ARGS=-race GIT_COMMIT=$(shell script/create-version-files.sh) GIT_RELEASE=$(shell script/get-git-release.sh) GIT_PREVIOUS_RELEASE=$(shell script/get-git-previous-release.sh) -GOLANGCI_VERSION=v1.47.3 +GOLANGCI_VERSION=v1.48.0 LINKER_TNF_RELEASE_FLAGS=-X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitCommit=${GIT_COMMIT} LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitRelease=${GIT_RELEASE} LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitPreviousRelease=${GIT_PREVIOUS_RELEASE} diff --git a/README.md b/README.md index 9dd1db2b8..6f8c09452 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ At a minimum, the following dependencies must be installed *prior* to running `m Dependency|Minimum Version ---|--- [GoLang](https://golang.org/dl/)|1.18 -[golangci-lint](https://golangci-lint.run/usage/install/)|1.47.0 +[golangci-lint](https://golangci-lint.run/usage/install/)|1.48.0 [jq](https://stedolan.github.io/jq/)|1.6 [OpenShift Client](https://mirror.openshift.com/pub/openshift-v4/clients/ocp/)|4.7 diff --git a/cmd/tnf/generate/catalog/catalog.go b/cmd/tnf/generate/catalog/catalog.go index 62c27d834..03486bc2b 100644 --- a/cmd/tnf/generate/catalog/catalog.go +++ b/cmd/tnf/generate/catalog/catalog.go @@ -82,16 +82,17 @@ func emitTextFromFile(filename string) error { // createPrintableCatalogFromIdentifiers creates an structured catalogue. // Decompose claim.Identifier urls like http://test-network-function.com/testcases/SuiteName/TestName // to get SuiteNames and TestNames and build a "more printable" catalogue in the way of: -// { -// suiteNameA: [ -// {testName, identifier{url, version}}, -// {testName2, identifier{url, version}} -// ] -// suiteNameB: [ -// {testName3, identifier{url, version}}, -// {testName4, identifier{url, version}} -// ] -// } +// +// { +// suiteNameA: [ +// {testName, identifier{url, version}}, +// {testName2, identifier{url, version}} +// ] +// suiteNameB: [ +// {testName3, identifier{url, version}}, +// {testName4, identifier{url, version}} +// ] +// } func createPrintableCatalogFromIdentifiers(keys []claim.Identifier) map[string][]catalogElement { catalog := make(map[string][]catalogElement) // we need the list of suite's names diff --git a/cnf-certification-test/accesscontrol/suite.go b/cnf-certification-test/accesscontrol/suite.go index 67f2dd427..677dca392 100644 --- a/cnf-certification-test/accesscontrol/suite.go +++ b/cnf-certification-test/accesscontrol/suite.go @@ -366,6 +366,7 @@ func TestPodServiceAccount(env *provider.TestEnvironment) { } // TestPodRoleBindings verifies that the pod utilizes a valid role binding that does not cross namespaces +// //nolint:dupl func TestPodRoleBindings(env *provider.TestEnvironment) { ginkgo.By("Should not have RoleBinding in other namespaces") @@ -396,6 +397,7 @@ func TestPodRoleBindings(env *provider.TestEnvironment) { } // TestPodClusterRoleBindings verifies that the pod utilizes a valid cluster role binding that does not cross namespaces +// //nolint:dupl func TestPodClusterRoleBindings(env *provider.TestEnvironment) { ginkgo.By("Should not have ClusterRoleBinding in other namespaces") diff --git a/cnf-certification-test/chaostesting/pod_delete/pod_delete.go b/cnf-certification-test/chaostesting/pod_delete/pod_delete.go index 9d7d2de34..8c0737120 100644 --- a/cnf-certification-test/chaostesting/pod_delete/pod_delete.go +++ b/cnf-certification-test/chaostesting/pod_delete/pod_delete.go @@ -244,7 +244,8 @@ func parseLitmusResult(crs *unstructured.UnstructuredList) bool { // createResource is a helper function that uses a yaml decoder to create in the cluster // all the resources defined in the underlying yaml file. -//nolint:funlen // +// +//nolint:funlen func createResource(decoder *yamlutil.YAMLOrJSONDecoder) error { oc := clientsholder.GetClientsHolder() k8sClient := oc.K8sClient diff --git a/cnf-certification-test/lifecycle/suite.go b/cnf-certification-test/lifecycle/suite.go index 1b0b659c9..a983f17ea 100644 --- a/cnf-certification-test/lifecycle/suite.go +++ b/cnf-certification-test/lifecycle/suite.go @@ -42,9 +42,7 @@ const ( minWorkerNodesForLifecycle = 2 ) -// // All actual test code belongs below here. Utilities belong above. -// var _ = ginkgo.Describe(common.LifecycleTestKey, func() { var env provider.TestEnvironment ginkgo.BeforeEach(func() { diff --git a/cnf-certification-test/networking/suite.go b/cnf-certification-test/networking/suite.go index 3cdd0a865..b2942516b 100644 --- a/cnf-certification-test/networking/suite.go +++ b/cnf-certification-test/networking/suite.go @@ -46,9 +46,7 @@ type Port []struct { Protocol string } -// // All actual test code belongs below here. Utilities belong above. -// var _ = ginkgo.Describe(common.NetworkingTestKey, func() { logrus.Debugf("Entering %s suite", common.NetworkingTestKey) diff --git a/cnf-certification-test/observability/suite.go b/cnf-certification-test/observability/suite.go index 17dfec130..c3b2e597d 100644 --- a/cnf-certification-test/observability/suite.go +++ b/cnf-certification-test/observability/suite.go @@ -35,9 +35,7 @@ import ( policyv1 "k8s.io/api/policy/v1" ) -// // All actual test code belongs below here. Utilities belong above. -// var _ = ginkgo.Describe(common.ObservabilityTestKey, func() { var env provider.TestEnvironment ginkgo.BeforeEach(func() { diff --git a/cnf-certification-test/operator/suite.go b/cnf-certification-test/operator/suite.go index 70d7bb975..dc2ee1edd 100644 --- a/cnf-certification-test/operator/suite.go +++ b/cnf-certification-test/operator/suite.go @@ -35,9 +35,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// // All actual test code belongs below here. Utilities belong above. -// var _ = ginkgo.Describe(common.OperatorTestKey, func() { var env provider.TestEnvironment ginkgo.BeforeEach(func() { diff --git a/cnf-certification-test/platform/cnffsdiff/fsdiff.go b/cnf-certification-test/platform/cnffsdiff/fsdiff.go index 10f1a8ba9..ed7ce4ba7 100644 --- a/cnf-certification-test/platform/cnffsdiff/fsdiff.go +++ b/cnf-certification-test/platform/cnffsdiff/fsdiff.go @@ -45,7 +45,9 @@ var ( // fsDiffJSON is a helper struct to unmarshall the "podman diff --format json" output: a slice of // folders/filepaths (strings) for each event type changed/added/deleted: -// {"changed": ["folder1, folder2"], added": ["folder5", "folder6"], "deleted": ["folder3", "folder4"]"} +// +// {"changed": ["folder1, folder2"], added": ["folder5", "folder6"], "deleted": ["folder3", "folder4"]"} +// // We'll only care about deleted and changed types, though, as in case a folder/file is created to any of them, // there will be two entries, one for the "added" and another for the "changed". type fsDiffJSON struct { diff --git a/cnf-certification-test/platform/suite.go b/cnf-certification-test/platform/suite.go index db4dd69b3..176843337 100644 --- a/cnf-certification-test/platform/suite.go +++ b/cnf-certification-test/platform/suite.go @@ -47,9 +47,7 @@ const ( istioContainerName = "istio-proxy" ) -// // All actual test code belongs below here. Utilities belong above. -// var _ = ginkgo.Describe(common.PlatformAlterationTestKey, func() { logrus.Debugf("Entering %s suite", common.PlatformAlterationTestKey) var env provider.TestEnvironment diff --git a/internal/clientsholder/clientsholder.go b/internal/clientsholder/clientsholder.go index 43adc9433..31036ac0c 100644 --- a/internal/clientsholder/clientsholder.go +++ b/internal/clientsholder/clientsholder.go @@ -64,6 +64,7 @@ func SetupFakeOlmClient(olmMockObjects []runtime.Object) { // Only pure k8s interfaces will be available. The runtime objects must be pure k8s ones. // For other (OLM, ) // runtime mocking objects loading, use the proper clientset mocking function. +// //nolint:funlen func GetTestClientsHolder(k8sMockObjects []runtime.Object, filenames ...string) *ClientsHolder { // Build slices of different objects depending on what client diff --git a/pkg/autodiscover/autodiscover.go b/pkg/autodiscover/autodiscover.go index 91972057e..ecb066bb7 100644 --- a/pkg/autodiscover/autodiscover.go +++ b/pkg/autodiscover/autodiscover.go @@ -93,8 +93,9 @@ func buildLabelKeyValue(label configuration.Label) (key, value string) { return key, value } -//nolint:funlen // DoAutoDiscover finds objects under test +// +//nolint:funlen func DoAutoDiscover() DiscoveredTestData { data.Env = *configuration.GetTestParameters() diff --git a/pkg/autodiscover/constants.go b/pkg/autodiscover/constants.go index 4638c1087..77a72e56b 100644 --- a/pkg/autodiscover/constants.go +++ b/pkg/autodiscover/constants.go @@ -17,13 +17,7 @@ package autodiscover const ( defaultNamespace = "default" - // debugDaemonSet = "debug" debugLabelPrefix = "test-network-function.com" debugLabelName = "app" debugLabelValue = "debug" - -// nodeLabelName = "test-network-function.com/node" -// nodeLabelValue = "target" -// addlabelCommand = "oc label node %s %s=%s --overwrite=true" -// deletelabelCommand = "oc label node %s %s- --overwrite=true" ) diff --git a/pkg/claimhelper/claimhelper.go b/pkg/claimhelper/claimhelper.go index b5e66bfae..9f4cba060 100644 --- a/pkg/claimhelper/claimhelper.go +++ b/pkg/claimhelper/claimhelper.go @@ -119,7 +119,6 @@ func WriteClaimOutput(claimOutputFile string, payload []byte) { } } -//no-lint:commentedOutCode func GenerateNodes() map[string]interface{} { const ( nodeSummaryField = "nodeSummary" diff --git a/pkg/loghelper/loghelper.go b/pkg/loghelper/loghelper.go index e18edc16c..2f5e1b949 100644 --- a/pkg/loghelper/loghelper.go +++ b/pkg/loghelper/loghelper.go @@ -32,6 +32,7 @@ type CuratedLogLines struct { } // AddLogLine checks a slice for a given string. +// //nolint:goprintffuncname func (list *CuratedLogLines) AddLogLine(format string, args ...interface{}) { message := fmt.Sprintf(format+"\n", args...)