Repository: metal3-io/baremetal-operator

Issue:
Enable "usetesting" linter in golangci-lint
Enable "usetesting" linter in golangci-lint. Fix any warnings enabling it causes.

/area ci
/help
/triage accepted

Hints from issue comments:
@metal3-io-bot: @tuminoid: 
	This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed [here](https://git.k8s.io/community/contributors/guide/help-wanted.md).

If this request no longer meets these requirements, the label can be removed
by commenting with the `/remove-help` command.


<details>

In response to [this](https://github.com/metal3-io/baremetal-operator/issues/2364):

>Enable "usetesting" linter in golangci-lint. Fix any warnings enabling it causes.
>
>/area ci
>/help
>/triage accepted


Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
</details>@metal3-io-bot: @tuminoid: The label(s) `area/ci` cannot be applied, because the repository doesn't have them.

<details>

In response to [this](https://github.com/metal3-io/baremetal-operator/issues/2364):

>Enable "usetesting" linter in golangci-lint. Fix any warnings enabling it causes.
>
>/area ci
>/help
>/triage accepted


Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
</details>@andriisoldatenko: @tuminoid i'm happy to help with this one, we did similar with our operator. @andriisoldatenko: here is a PR -> https://github.com/metal3-io/baremetal-operator/pull/2380/files

Solution patch:
diff --git a/.golangci.yaml b/.golangci.yaml
index d9f134da..45a6a293 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -73,7 +73,7 @@ linters:
   - unparam
   - unused
   - usestdlibvars
-  #- usetesting
+  - usetesting
   - whitespace
   # Run with --fast=false for more extensive checks
   fast: true



Test patch:
diff --git a/pkg/provisioner/ironic/clients/auth_test.go b/pkg/provisioner/ironic/clients/auth_test.go
index b4b81efb..13514418 100644
--- a/pkg/provisioner/ironic/clients/auth_test.go
+++ b/pkg/provisioner/ironic/clients/auth_test.go
@@ -106,11 +106,11 @@ func TestLoadAuth(t *testing.T) {
 	setup := func(authRoot string, createFiles bool) (cleanup func(), err error) {
 		originalAuthRoot := os.Getenv("METAL3_AUTH_ROOT_DIR")
 		cleanup = func() {
-			_ = os.Setenv("METAL3_AUTH_ROOT_DIR", originalAuthRoot)
+			t.Setenv("METAL3_AUTH_ROOT_DIR", originalAuthRoot)
 			_ = os.RemoveAll(authRoot)
 		}
 
-		_ = os.Setenv("METAL3_AUTH_ROOT_DIR", authRoot)
+		t.Setenv("METAL3_AUTH_ROOT_DIR", authRoot)
 
 		if createFiles {
 			authPath := path.Join(authRoot, "ironic")