From da769d37b84b5e75f4a4fa877b1a116d5a3ebb74 Mon Sep 17 00:00:00 2001 From: Piotr Halama Date: Thu, 12 Sep 2024 11:04:47 +0200 Subject: [PATCH] Lint tests (#2216) --- .golangci.yaml | 5 ++++- internal/communitymodules/modules_test.go | 2 +- internal/kube/kyma/kyma_test.go | 2 -- internal/registry/portforward/transport_test.go | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index c75faeee8..2d22e1a92 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,7 +1,6 @@ run: modules-download-mode: readonly timeout: 15m - tests: false linters: disable-all: true enable: @@ -23,3 +22,7 @@ issues: - "unexported-return:" - "context-as-argument:" - "and that stutters" + - '`fixTestDeployment` - `namespace` always receives `"kyma-system"' + - "`fixCheckConfig` - `name` always receives `name`" + - "`fixCheckConfig` - `namespace` always receives `namespace`" + - "`fixTestHanaServiceBinding` - `namespace` always receives `namespace" diff --git a/internal/communitymodules/modules_test.go b/internal/communitymodules/modules_test.go index 197739a40..6e9d0b655 100644 --- a/internal/communitymodules/modules_test.go +++ b/internal/communitymodules/modules_test.go @@ -237,7 +237,7 @@ func Test_installedModules(t *testing.T) { func fixHttpResponseHandler(status int, response string) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(status) - w.Write([]byte(response)) + _, _ = w.Write([]byte(response)) } } diff --git a/internal/kube/kyma/kyma_test.go b/internal/kube/kyma/kyma_test.go index 64a57ba51..1d699a79f 100644 --- a/internal/kube/kyma/kyma_test.go +++ b/internal/kube/kyma/kyma_test.go @@ -131,8 +131,6 @@ func TestUpdateDefaultKyma(t *testing.T) { func Test_disableModule(t *testing.T) { t.Parallel() - type args struct { - } tests := []struct { name string kymaCR *Kyma diff --git a/internal/registry/portforward/transport_test.go b/internal/registry/portforward/transport_test.go index 029a5667f..32188d89a 100644 --- a/internal/registry/portforward/transport_test.go +++ b/internal/registry/portforward/transport_test.go @@ -178,7 +178,7 @@ func fixDataStreamMock(t *testing.T, req *http.Request, resp *http.Response) htt reqBytes := reqBuf.Bytes() responseBuf := bytes.NewBuffer([]byte{}) - resp.Write(responseBuf) + _ = resp.Write(responseBuf) dataStreamMock := automock.NewStream(t) dataStreamMock.On("Close").Return(nil).Twice()