Repository: kubernetes-sigs/security-profiles-operator
Pull request #219 (2021-01-22 11:44:38)

Update golangci-lint and run tests in parallel
#### What type of PR is this?

/kind cleanup

#### What this PR does / why we need it:
We now enable additional linters with the bump of golangci-lint. The
tests are now using the t.Parallel() method to let them executed
simultaneously.
#### Which issue(s) this PR fixes:

<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.

Fixes #

or

None
-->
None
#### Special notes for your reviewer:
None
#### Does this PR introduce a user-facing change?

<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".

For more information on release notes see: https://git.k8s.io/community/contributors/guide/release-notes.md
-->

```release-note
None
```


k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/219#" title="Author self-approved">saschagrunert</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/security-profiles-operator/blob/master/OWNERS)~~ [saschagrunert]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
JAORMX: Now that the tests are being parallelized, should we enable the `-race` flag in both the build and the test invocation?
saschagrunert: > Now that the tests are being parallelized, should we enable the `-race` flag in both the build and the test invocation?

Good point, I enabled it for the tests. 

I think we should keep it disabled for the (production) build, because I'm not sure about the performance implications when enabling the race detector.
JAORMX: /lgtm

Patch:
diff --git a/.golangci.yml b/.golangci.yml
index 1d4c3e458..c3a24f1e1 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,8 +1,10 @@
 ---
 run:
   build-tags:
-    - netgo
     - e2e
+    - netgo
+    - osusergo
+    - seccomp
   concurrency: 6
   deadline: 5m
 linters:
@@ -41,18 +43,23 @@ linters:
     - ineffassign
     - interfacer
     - lll
+    - makezero
     - maligned
     - misspell
     - nakedret
     - nestif
     - noctx
     - nolintlint
+    - paralleltest
     - prealloc
+    - predeclared
     - rowserrcheck
+    - scopelint
     - sqlclosecheck
     - staticcheck
     - structcheck
     - stylecheck
+    - thelper
     - tparallel
     - typecheck
     - unconvert
@@ -62,10 +69,10 @@ linters:
     - whitespace
     - wrapcheck
     # - exhaustivestruct
+    # - forbidigo
     # - funlen
     # - gochecknoglobals
     # - nlreturn
-    # - scopelint
     # - testpackage
     # - wsl
 linters-settings:
diff --git a/Makefile b/Makefile
index 65557d5d9..31bcf452a 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ VERSION := $(shell cat VERSION)
 ifneq ($(shell uname -s), Darwin)
 BUILDTAGS := netgo osusergo seccomp
 else
-BUILDTAGS := netgo osusergo 
+BUILDTAGS := netgo osusergo
 endif
 BUILD_FILES := $(shell find . -type f -name '*.go' -or -name '*.mod' -or -name '*.sum' -not -name '*_test.go')
 export GOFLAGS?=-mod=mod
@@ -60,7 +60,7 @@ IMAGE ?= $(PROJECT):latest
 
 CRD_OPTIONS ?= "crd:crdVersions=v1"
 
-GOLANGCI_LINT_VERSION = v1.32.0
+GOLANGCI_LINT_VERSION = v1.35.2
 REPO_INFRA_VERSION = v0.1.2
 
 export E2E_CLUSTER_TYPE ?= kind
@@ -154,12 +154,12 @@ $(BUILD_DIR)/golangci-lint:
 
 .PHONY: test-unit
 test-unit: $(BUILD_DIR) ## Run the unit tests
-	$(GO) test -ldflags '$(LDVARS)' -tags '$(BUILDTAGS)' -v -test.coverprofile=$(BUILD_DIR)/coverage.out ./internal/...
+	$(GO) test -ldflags '$(LDVARS)' -tags '$(BUILDTAGS)' -race -v -test.coverprofile=$(BUILD_DIR)/coverage.out ./internal/...
 	$(GO) tool cover -html $(BUILD_DIR)/coverage.out -o $(BUILD_DIR)/coverage.html
 
 .PHONY: test-e2e
 test-e2e: ## Run the end-to-end tests
-	$(GO) test -timeout 40m -count=1 ./test/... -v
+	$(GO) test -race -timeout 40m -count=1 ./test/... -v
 
 # Generate CRD manifests
 manifests:
@@ -196,7 +196,7 @@ push-openshift-dev: set-openshift-image-params openshift-user image
 		$(CONTAINER_RUNTIME) push $(LOGIN_PUSH_OPTS) localhost/$(IMAGE) $${IMAGE_REGISTRY_HOST}/openshift/$(IMAGE)
 
 .PHONY: do-deploy-openshift-dev
-do-deploy-openshift-dev: 
+do-deploy-openshift-dev:
 	@echo "Building custom operator.yaml"
 	kustomize build --reorder=none deploy/overlays/openshift-dev -o deploy/operator.yaml
 	@echo "Deploying"
diff --git a/hack/pull-security-profiles-operator-verify b/hack/pull-security-profiles-operator-verify
index a19543d6f..41cf5c7f3 100755
--- a/hack/pull-security-profiles-operator-verify
+++ b/hack/pull-security-profiles-operator-verify
@@ -3,7 +3,7 @@ set -euo pipefail
 
 # assume a Debian based golang image, like: golang:1.15
 apt-get update
-apt-get install -y python3
+apt-get install -y libseccomp-dev python3
 
 # install kustomize
 pushd /usr/bin


Test patch:
diff --git a/internal/pkg/controllers/profile/profile_test.go b/internal/pkg/controllers/profile/profile_test.go
index 151bccc63..f17e4531b 100644
--- a/internal/pkg/controllers/profile/profile_test.go
+++ b/internal/pkg/controllers/profile/profile_test.go
@@ -41,6 +41,8 @@ import (
 )
 
 func TestReconcile(t *testing.T) {
+	t.Parallel()
+
 	name := "cool-profile"
 	namespace := "cool-namespace"
 
@@ -54,13 +56,15 @@ func TestReconcile(t *testing.T) {
 		return nil
 	}
 
-	cases := map[string]struct {
+	cases := []struct {
+		name       string
 		rec        *Reconciler
 		req        reconcile.Request
 		wantResult reconcile.Result
 		wantErr    error
 	}{
-		"ProfileNotFound": {
+		{
+			name: "ProfileNotFound",
 			rec: &Reconciler{
 				client: &test.MockClient{
 					MockGet: test.NewMockGetFn(kerrors.NewNotFound(schema.GroupResource{}, name)),
@@ -71,7 +75,8 @@ func TestReconcile(t *testing.T) {
 			wantResult: reconcile.Result{},
 			wantErr:    nil,
 		},
-		"ErrGetProfileIfSeccompEnabled": {
+		{
+			name: "ErrGetProfileIfSeccompEnabled",
 			rec: &Reconciler{
 				client: &test.MockClient{
 					MockGet: test.NewMockGetFn(errOops),
@@ -83,7 +88,8 @@ func TestReconcile(t *testing.T) {
 			wantResult: reconcile.Result{},
 			wantErr:    errors.Wrap(getErrorIfSeccompEnabled(errOops), errGetProfile),
 		},
-		"GotProfile": {
+		{
+			name: "GotProfile",
 			rec: &Reconciler{
 				client: &test.MockClient{
 					MockGet:          test.NewMockGetFn(nil),
@@ -100,8 +106,11 @@ func TestReconcile(t *testing.T) {
 		},
 	}
 
-	for name, tc := range cases {
-		t.Run(name, func(t *testing.T) {
+	for _, tc := range cases {
+		tc := tc
+		t.Run(tc.name, func(t *testing.T) {
+			t.Parallel()
+
 			gotResult, gotErr := tc.rec.Reconcile(tc.req)
 			if tc.wantErr != nil {
 				require.EqualError(t, gotErr, tc.wantErr.Error())
@@ -113,6 +122,8 @@ func TestReconcile(t *testing.T) {
 
 // Expected perms on file.
 func TestSaveProfileOnDisk(t *testing.T) {
+	t.Parallel()
+
 	// TODO: fix root user execution for this test
 	if os.Getuid() == 0 {
 		t.Skip("Test does not work as root user")
@@ -121,21 +132,24 @@ func TestSaveProfileOnDisk(t *testing.T) {
 	if err != nil {
 		t.Error(errors.Wrap(err, "error creating temp file for tests"))
 	}
-	defer os.RemoveAll(dir)
+	t.Cleanup(func() { os.RemoveAll(dir) })
 
-	cases := map[string]struct {
+	cases := []struct {
+		name        string
 		setup       func()
 		fileName    string
 		contents    string
 		wantErr     string
 		fileCreated bool
 	}{
-		"CreateDirsAndWriteFile": {
+		{
+			name:        "CreateDirsAndWriteFile",
 			fileName:    path.Join(dir, "/seccomp/operator/namespace/sp/filename.json"),
 			contents:    "some content",
 			fileCreated: true,
 		},
-		"NoPermissionToWriteFile": {
+		{
+			name: "NoPermissionToWriteFile",
 			setup: func() {
 				targetDir := path.Join(dir, "/test/nopermissions")
 				require.Nil(t, os.MkdirAll(targetDir, dirPermissionMode))
@@ -146,7 +160,8 @@ func TestSaveProfileOnDisk(t *testing.T) {
 			fileCreated: false,
 			wantErr:     "cannot save profile: open " + dir + "/test/nopermissions/filename.json: permission denied",
 		},
-		"NoPermissionToWriteDir": {
+		{
+			name: "NoPermissionToWriteDir",
 			setup: func() {
 				targetDir := path.Join(dir, "/nopermissions")
 				require.Nil(t, os.MkdirAll(targetDir, dirPermissionMode))
@@ -159,8 +174,11 @@ func TestSaveProfileOnDisk(t *testing.T) {
 		},
 	}
 
-	for name, tc := range cases {
-		t.Run(name, func(t *testing.T) {
+	for _, tc := range cases {
+		tc := tc
+		t.Run(tc.name, func(t *testing.T) {
+			t.Parallel()
+
 			if tc.setup != nil {
 				tc.setup()
 			}
@@ -180,12 +198,16 @@ func TestSaveProfileOnDisk(t *testing.T) {
 }
 
 func TestGetProfilePath(t *testing.T) {
-	cases := map[string]struct {
+	t.Parallel()
+
+	cases := []struct {
+		name    string
 		want    string
 		wantErr string
 		sp      *v1alpha1.SeccompProfile
 	}{
-		"AppendNamespaceAndProfile": {
+		{
+			name: "AppendNamespaceAndProfile",
 			want: path.Join(config.ProfilesRootPath, "config-namespace", "config-target", "file.json"),
 			sp: &v1alpha1.SeccompProfile{
 				ObjectMeta: metav1.ObjectMeta{
@@ -197,7 +219,8 @@ func TestGetProfilePath(t *testing.T) {
 				},
 			},
 		},
-		"BlockTraversalAtProfileName": {
+		{
+			name: "BlockTraversalAtProfileName",
 			want: path.Join(config.ProfilesRootPath, "ns", "config-target", "file.json"),
 			sp: &v1alpha1.SeccompProfile{
 				ObjectMeta: metav1.ObjectMeta{
@@ -209,7 +232,8 @@ func TestGetProfilePath(t *testing.T) {
 				},
 			},
 		},
-		"BlockTraversalAtTargetName": {
+		{
+			name: "BlockTraversalAtTargetName",
 			want: path.Join(config.ProfilesRootPath, "ns", "config-target", "file.json"),
 			sp: &v1alpha1.SeccompProfile{
 				ObjectMeta: metav1.ObjectMeta{
@@ -221,7 +245,8 @@ func TestGetProfilePath(t *testing.T) {
 				},
 			},
 		},
-		"BlockTraversalAtSPNamespace": {
+		{
+			name: "BlockTraversalAtSPNamespace",
 			want: path.Join(config.ProfilesRootPath, "ns", "config-target", "file.json"),
 			sp: &v1alpha1.SeccompProfile{
 				ObjectMeta: metav1.ObjectMeta{
@@ -233,7 +258,8 @@ func TestGetProfilePath(t *testing.T) {
 				},
 			},
 		},
-		"AppendExtension": {
+		{
+			name: "AppendExtension",
 			want: path.Join(config.ProfilesRootPath, "config-namespace", "config-target", "file.json"),
 			sp: &v1alpha1.SeccompProfile{
 				ObjectMeta: metav1.ObjectMeta{
@@ -247,8 +273,11 @@ func TestGetProfilePath(t *testing.T) {
 		},
 	}
 
-	for name, tc := range cases {
-		t.Run(name, func(t *testing.T) {
+	for _, tc := range cases {
+		tc := tc
+		t.Run(tc.name, func(t *testing.T) {
+			t.Parallel()
+
 			got, gotErr := GetProfilePath(tc.sp.ObjectMeta.Name, tc.sp.ObjectMeta.Namespace, tc.sp.Spec.TargetWorkload)
 			if tc.wantErr == "" {
 				require.NoError(t, gotErr)
@@ -261,26 +290,33 @@ func TestGetProfilePath(t *testing.T) {
 }
 
 func TestIgnoreNotFound(t *testing.T) {
-	name := "cool-profile"
+	t.Parallel()
 
+	profileName := "cool-profile"
 	errOops := errors.New("oops")
 
-	cases := map[string]struct {
+	cases := []struct {
+		name string
 		err  error
 		want error
 	}{
-		"IsErrorNotFound": {
-			err:  kerrors.NewNotFound(schema.GroupResource{}, name),
+		{
+			name: "IsErrorNotFound",
+			err:  kerrors.NewNotFound(schema.GroupResource{}, profileName),
 			want: nil,
 		},
-		"OtherError": {
+		{
+			name: "OtherError",
 			err:  errOops,
 			want: errOops,
 		},
 	}
 
-	for name, tc := range cases {
-		t.Run(name, func(t *testing.T) {
+	for _, tc := range cases {
+		tc := tc
+		t.Run(tc.name, func(t *testing.T) {
+			t.Parallel()
+
 			got := ignoreNotFound(tc.err)
 			require.Equal(t, tc.want, got)
 		})
@@ -288,17 +324,22 @@ func TestIgnoreNotFound(t *testing.T) {
 }
 
 func TestUnionSyscalls(t *testing.T) {
-	cases := map[string]struct {
+	t.Parallel()
+
+	cases := []struct {
+		name            string
 		baseSyscalls    []*v1alpha1.Syscall
 		appliedSyscalls []*v1alpha1.Syscall
 		want            []*v1alpha1.Syscall
 	}{
-		"BothEmpty": {
+		{
+			name:            "BothEmpty",
 			baseSyscalls:    []*v1alpha1.Syscall{},
 			appliedSyscalls: []*v1alpha1.Syscall{},
 			want:            []*v1alpha1.Syscall{},
 		},
-		"BaseEmpty": {
+		{
+			name:         "BaseEmpty",
 			baseSyscalls: []*v1alpha1.Syscall{},
 			appliedSyscalls: []*v1alpha1.Syscall{
 				{
@@ -313,7 +354,8 @@ func TestUnionSyscalls(t *testing.T) {
 				},
 			},
 		},
-		"AppliedEmpty": {
+		{
+			name: "AppliedEmpty",
 			baseSyscalls: []*v1alpha1.Syscall{
 				{
 					Names:  []string{"a", "b", "c"},
@@ -328,7 +370,8 @@ func TestUnionSyscalls(t *testing.T) {
 				},
 			},
 		},
-		"UniqueActions": {
+		{
+			name: "UniqueActions",
 			baseSyscalls: []*v1alpha1.Syscall{
 				{
 					Names:  []string{"a", "b", "c"},
@@ -352,7 +395,8 @@ func TestUnionSyscalls(t *testing.T) {
 				},
 			},
 		},
-		"OverlappingActionsWithUniqueNames": {
+		{
+			name: "OverlappingActionsWithUniqueNames",
 			baseSyscalls: []*v1alpha1.Syscall{
 				{
 					Names:  []string{"a", "b", "c"},
@@ -372,7 +416,8 @@ func TestUnionSyscalls(t *testing.T) {
 				},
 			},
 		},
-		"OverlappingActionsWithOverlappingNames": {
+		{
+			name: "OverlappingActionsWithOverlappingNames",
 			baseSyscalls: []*v1alpha1.Syscall{
 				{
 					Names:  []string{"a", "b", "c"},
@@ -406,8 +451,11 @@ func TestUnionSyscalls(t *testing.T) {
 		},
 	}
 
-	for name, tc := range cases {
-		t.Run(name, func(t *testing.T) {
+	for _, tc := range cases {
+		tc := tc
+		t.Run(tc.name, func(t *testing.T) {
+			t.Parallel()
+
 			got := unionSyscalls(tc.baseSyscalls, tc.appliedSyscalls)
 			for i := range got {
 				sort.Strings(got[i].Names)
@@ -421,13 +469,17 @@ func TestUnionSyscalls(t *testing.T) {
 }
 
 func TestGetSeccompProfilesFromPod(t *testing.T) {
+	t.Parallel()
+
 	profilePath := "operator/default/example-profiles/test.json"
 	profilePath2 := "operator/default/example-profiles/test2.json"
-	cases := map[string]struct {
+	cases := []struct {
+		name string
 		pod  corev1.Pod
 		want []string
 	}{
-		"SeccompProfileForPod": {
+		{
+			name: "SeccompProfileForPod",
 			pod: corev1.Pod{
 				Spec: corev1.PodSpec{
 					Containers: []corev1.Container{{Name: "container1", Image: "testimage"}},
@@ -441,7 +493,8 @@ func TestGetSeccompProfilesFromPod(t *testing.T) {
 			},
 			want: []string{profilePath},
 		},
-		"SeccompProfileForOneContainer": {
+		{
+			name: "SeccompProfileForOneContainer",
 			pod: corev1.Pod{
 				Spec: corev1.PodSpec{
 					Containers: []corev1.Container{{
@@ -458,7 +511,8 @@ func TestGetSeccompProfilesFromPod(t *testing.T) {
 			},
 			want: []string{profilePath},
 		},
-		"SeccompProfileForMultipleContainers": {
+		{
+			name: "SeccompProfileForMultipleContainers",
 			pod: corev1.Pod{
 				Spec: corev1.PodSpec{
 					Containers: []corev1.Container{
@@ -487,7 +541,8 @@ func TestGetSeccompProfilesFromPod(t *testing.T) {
 			},
 			want: []string{profilePath, profilePath2},
 		},
-		"SeccompProfileInAnnotation": {
+		{
+			name: "SeccompProfileInAnnotation",
 			pod: corev1.Pod{
 				ObjectMeta: metav1.ObjectMeta{
 					Annotations: map[string]string{corev1.SeccompPodAnnotationKey: "localhost/" + profilePath},
@@ -498,7 +553,8 @@ func TestGetSeccompProfilesFromPod(t *testing.T) {
 			},
 			want: []string{profilePath},
 		},
-		"SeccompProfileInPodAndContainerAndAnnotation": {
+		{
+			name: "SeccompProfileInPodAndContainerAndAnnotation",
 			pod: corev1.Pod{
 				ObjectMeta: metav1.ObjectMeta{
 					Annotations: map[string]string{corev1.SeccompPodAnnotationKey: "localhost/" + profilePath},
@@ -532,8 +588,11 @@ func TestGetSeccompProfilesFromPod(t *testing.T) {
 		},
 	}
 
-	for name, tc := range cases {
-		t.Run(name, func(t *testing.T) {
+	for _, tc := range cases {
+		tc := tc
+		t.Run(tc.name, func(t *testing.T) {
+			t.Parallel()
+
 			got := getSeccompProfilesFromPod(&tc.pod)
 			require.Equal(t, tc.want, got)
 		})
@@ -550,16 +609,33 @@ func TestGetSeccompProfilesFromPod(t *testing.T) {
 			},
 		},
 	}
-	badCases := map[string]string{
-		"NoSuffix":         "operator/default/example-profiles/test",
-		"BadSuffix":        "operator/default/example-profiles/test.js",
-		"WrongPath":        "foo/bar/baz",
-		"NotLocalhostPath": "runtime/default",
+	badCases := []struct {
+		name    string
+		profile string
+	}{
+		{
+			name:    "NoSuffix",
+			profile: "operator/default/example-profiles/test",
+		},
+		{
+			name:    "BadSuffix",
+			profile: "operator/default/example-profiles/test.js",
+		},
+		{
+			name:    "WrongPath",
+			profile: "foo/bar/baz",
+		},
+		{
+			name:    "NotLocalhostPath",
+			profile: "runtime/default",
+		},
 	}
-	for name, c := range badCases {
-		lhp := c
-		badPod.Spec.SecurityContext.SeccompProfile.LocalhostProfile = &lhp
-		t.Run(name, func(t *testing.T) {
+	for _, tc := range badCases {
+		tc := tc
+		badPod.Spec.SecurityContext.SeccompProfile.LocalhostProfile = &tc.profile
+		t.Run(tc.name, func(t *testing.T) {
+			t.Parallel()
+
 			got := getSeccompProfilesFromPod(&badPod)
 			require.Equal(t, []string{}, got)
 		})
diff --git a/internal/pkg/controllers/spod/setup_test.go b/internal/pkg/controllers/spod/setup_test.go
index 572ae2f77..a926f7874 100644
--- a/internal/pkg/controllers/spod/setup_test.go
+++ b/internal/pkg/controllers/spod/setup_test.go
@@ -25,6 +25,7 @@ import (
 )
 
 func Test_getEffectiveSPOd(t *testing.T) {
+	t.Parallel()
 	tests := []struct {
 		name    string
 		dt      DaemonTunables
@@ -45,7 +46,9 @@ func Test_getEffectiveSPOd(t *testing.T) {
 		},
 	}
 	for _, tt := range tests {
+		tt := tt
 		t.Run(tt.name, func(t *testing.T) {
+			t.Parallel()
 			got := getEffectiveSPOd(tt.dt)
 			require.Equal(t, tt.dt.DaemonImage, got.Spec.Template.Spec.Containers[0].Image)
 			require.Equal(t, tt.dt.NonRootEnablerImage, got.Spec.Template.Spec.InitContainers[0].Image)
diff --git a/internal/pkg/version/version_test.go b/internal/pkg/version/version_test.go
index 1bb331151..210fbeb11 100644
--- a/internal/pkg/version/version_test.go
+++ b/internal/pkg/version/version_test.go
@@ -23,6 +23,8 @@ import (
 )
 
 func TestVersionText(t *testing.T) {
+	t.Parallel()
+
 	sut := Get()
 	require.NotEmpty(t, sut.BuildDate)
 	require.NotEmpty(t, sut.Compiler)
@@ -35,6 +37,8 @@ func TestVersionText(t *testing.T) {
 }
 
 func TestVersionJSON(t *testing.T) {
+	t.Parallel()
+
 	sut, err := Get().JSONString()
 	require.Nil(t, err)
 	require.NotEmpty(t, sut)
diff --git a/internal/pkg/webhooks/binding/webhook_test.go b/internal/pkg/webhooks/binding/webhook_test.go
index 9db38fb99..157e6ca81 100644
--- a/internal/pkg/webhooks/binding/webhook_test.go
+++ b/internal/pkg/webhooks/binding/webhook_test.go
@@ -24,15 +24,20 @@ import (
 )
 
 func TestNewContainerMap(t *testing.T) {
-	cases := map[string]struct {
+	t.Parallel()
+
+	cases := []struct {
+		name    string
 		podSpec *corev1.PodSpec
 		want    containerMap
 	}{
-		"NoContainers": {
+		{
+			name:    "NoContainers",
 			podSpec: &corev1.PodSpec{},
 			want:    map[string][]*corev1.Container{},
 		},
-		"OnlyContainers": {
+		{
+			name: "OnlyContainers",
 			podSpec: &corev1.PodSpec{
 				Containers: []corev1.Container{
 					{
@@ -60,7 +65,8 @@ func TestNewContainerMap(t *testing.T) {
 				},
 			},
 		},
-		"OnlyInitContainers": {
+		{
+			name: "OnlyInitContainers",
 			podSpec: &corev1.PodSpec{
 				InitContainers: []corev1.Container{
 					{
@@ -88,7 +94,8 @@ func TestNewContainerMap(t *testing.T) {
 				},
 			},
 		},
-		"ContainersAndInitContainers": {
+		{
+			name: "ContainersAndInitContainers",
 			podSpec: &corev1.PodSpec{
 				InitContainers: []corev1.Container{{
 					Name:  "init",
@@ -114,7 +121,8 @@ func TestNewContainerMap(t *testing.T) {
 				},
 			},
 		},
-		"DuplicateImages": {
+		{
+			name: "DuplicateImages",
 			podSpec: &corev1.PodSpec{
 				InitContainers: []corev1.Container{{
 					Name:  "init",
@@ -140,8 +148,11 @@ func TestNewContainerMap(t *testing.T) {
 		},
 	}
 
-	for name, tc := range cases {
-		t.Run(name, func(t *testing.T) {
+	for _, tc := range cases {
+		tc := tc
+		t.Run(tc.name, func(t *testing.T) {
+			t.Parallel()
+
 			result := newContainerMap(tc.podSpec)
 			for k, v := range result {
 				require.Equal(t, tc.want[k], v)
diff --git a/test/suite_test.go b/test/suite_test.go
index f1e704762..831610fea 100644
--- a/test/suite_test.go
+++ b/test/suite_test.go
@@ -65,6 +65,7 @@ type openShifte2e struct {
 }
 
 func TestSuite(t *testing.T) {
+	t.Parallel()
 	fmt.Printf("cluster-type: %s\n", clusterType)
 
 	switch {