Repository: kubernetes-sigs/security-profiles-operator
Pull request #148 (2020-10-29 19:06:08)

Remove e2e build tag in favor of scoped tests

#### What type of PR is this?

/kind cleanup

#### What this PR does / why we need it:
The build tag is not required since we already split the tests between
`internal` and `test` directory.
#### 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/148#" 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":[]} -->
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/148#pullrequestreview-519988661" title="LGTM">hasheddan</a>*, *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/148#" 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)~~ [hasheddan,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":[]} -->

Patch:
diff --git a/.golangci.yml b/.golangci.yml
index 7ff7245f7..1d4c3e458 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -15,6 +15,7 @@ linters:
     - dogsled
     - dupl
     - errcheck
+    - errorlint
     - exhaustive
     - exportloopref
     - gci
@@ -52,12 +53,15 @@ linters:
     - staticcheck
     - structcheck
     - stylecheck
+    - tparallel
     - typecheck
     - unconvert
     - unparam
     - unused
     - varcheck
     - whitespace
+    - wrapcheck
+    # - exhaustivestruct
     # - funlen
     # - gochecknoglobals
     # - nlreturn
diff --git a/Makefile b/Makefile
index 456e46031..c4450f21c 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,7 @@ IMAGE ?= $(PROJECT):latest
 
 CRD_OPTIONS ?= "crd:crdVersions=v1"
 
-GOLANGCI_LINT_VERSION = v1.31.0
+GOLANGCI_LINT_VERSION = v1.32.0
 REPO_INFRA_VERSION = v0.1.1
 
 # Utility targets
@@ -131,12 +131,12 @@ $(BUILD_DIR)/golangci-lint:
 
 .PHONY: test-unit
 test-unit: $(BUILD_DIR) ## Run the unit tests
-	$(GO) test -ldflags '$(LDVARS)' -v -test.coverprofile=$(BUILD_DIR)/coverage.out ./...
+	$(GO) test -ldflags '$(LDVARS)' -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 -tags e2e -count=1 ./test/... -v
+	$(GO) test -timeout 40m -count=1 ./test/... -v
 
 # Generate CRD manifest
 manifests:
diff --git a/internal/pkg/version/version.go b/internal/pkg/version/version.go
index f14ae8510..efa58b998 100644
--- a/internal/pkg/version/version.go
+++ b/internal/pkg/version/version.go
@@ -22,6 +22,8 @@ import (
 	"runtime"
 	"strings"
 	"text/tabwriter"
+
+	"github.com/pkg/errors"
 )
 
 var (
@@ -74,7 +76,7 @@ func (i *Info) String() string {
 func (i *Info) JSONString() (string, error) {
 	b, err := json.MarshalIndent(i, "", "  ")
 	if err != nil {
-		return "", err
+		return "", errors.Wrap(err, "marshal info as JSON")
 	}
 	return string(b), nil
 }


Test patch:
diff --git a/test/e2e_test.go b/test/e2e_test.go
index d6bd28b22..ca6567b7c 100644
--- a/test/e2e_test.go
+++ b/test/e2e_test.go
@@ -1,5 +1,3 @@
-// +build e2e
-
 /*
 Copyright 2020 The Kubernetes Authors.
 
diff --git a/test/suite_test.go b/test/suite_test.go
index e2497a624..0cc1ebc18 100644
--- a/test/suite_test.go
+++ b/test/suite_test.go
@@ -1,5 +1,3 @@
-// +build e2e
-
 /*
 Copyright 2020 The Kubernetes Authors.
 
diff --git a/test/tc_default_profiles_test.go b/test/tc_default_profiles_test.go
index 8a6693638..9f457c78d 100644
--- a/test/tc_default_profiles_test.go
+++ b/test/tc_default_profiles_test.go
@@ -1,5 +1,3 @@
-// +build e2e
-
 /*
 Copyright 2020 The Kubernetes Authors.
 
diff --git a/test/tc_redeploy_operator_test.go b/test/tc_redeploy_operator_test.go
index adb8c9497..708c904a2 100644
--- a/test/tc_redeploy_operator_test.go
+++ b/test/tc_redeploy_operator_test.go
@@ -1,5 +1,3 @@
-// +build e2e
-
 /*
 Copyright 2020 The Kubernetes Authors.
 
diff --git a/test/tc_run_pod_test.go b/test/tc_run_pod_test.go
index 8124ec162..cff5eb9ac 100644
--- a/test/tc_run_pod_test.go
+++ b/test/tc_run_pod_test.go
@@ -1,5 +1,3 @@
-// +build e2e
-
 /*
 Copyright 2020 The Kubernetes Authors.