From b39f3b15fbf1abf59177b58b6e87a44e32600bbe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 05:28:48 +0000 Subject: [PATCH] chore(deps): update module github.com/golangci/golangci-lint to v1.62.0 (#20737) * chore(deps): update module github.com/golangci/golangci-lint to v1.62.0 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix lint issues Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- .github/workflows/ci-build.yaml | 2 +- applicationset/generators/plugin_test.go | 2 +- applicationset/utils/createOrUpdate_test.go | 2 +- cmd/argocd/commands/common_test.go | 12 ++++++------ controller/appcontroller_test.go | 2 +- hack/installers/install-lint-tools.sh | 2 +- pkg/apis/application/v1alpha1/types_test.go | 2 ++ server/application/application_test.go | 2 +- test/e2e/app_management_test.go | 2 +- test/e2e/fixture/project/actions.go | 2 +- util/argo/diff/ignore_test.go | 2 ++ util/exec/exec_test.go | 4 ++-- util/oidc/oidc_test.go | 2 +- util/settings/accounts_test.go | 4 ++-- 14 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 6acbbad93cf71..9fb2ffeb23d1a 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -112,7 +112,7 @@ jobs: uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 with: # renovate: datasource=go packageName=github.com/golangci/golangci-lint versioning=regex:^v(?\d+)\.(?\d+)\.(?\d+)?$ - version: v1.61.0 + version: v1.62.0 args: --verbose test-go: diff --git a/applicationset/generators/plugin_test.go b/applicationset/generators/plugin_test.go index 55ebcfd5c7820..0ade708ee569b 100644 --- a/applicationset/generators/plugin_test.go +++ b/applicationset/generators/plugin_test.go @@ -694,7 +694,7 @@ func TestPluginGenerateParams(t *testing.T) { require.NoError(t, err) gotJson, err := json.Marshal(got) require.NoError(t, err) - assert.Equal(t, string(expectedJson), string(gotJson)) + assert.JSONEq(t, string(expectedJson), string(gotJson)) } }) } diff --git a/applicationset/utils/createOrUpdate_test.go b/applicationset/utils/createOrUpdate_test.go index 2dc5945d2d2cc..de64541337178 100644 --- a/applicationset/utils/createOrUpdate_test.go +++ b/applicationset/utils/createOrUpdate_test.go @@ -229,7 +229,7 @@ spec: require.NoError(t, err) yamlExpected, err := yaml.Marshal(tc.expectedApp) require.NoError(t, err) - assert.Equal(t, string(yamlExpected), string(yamlFound)) + assert.YAMLEq(t, string(yamlExpected), string(yamlFound)) }) } } diff --git a/cmd/argocd/commands/common_test.go b/cmd/argocd/commands/common_test.go index 24ab6ebcf7fd9..8a3a2446a6989 100644 --- a/cmd/argocd/commands/common_test.go +++ b/cmd/argocd/commands/common_test.go @@ -81,14 +81,14 @@ func Test_PrintResource(t *testing.T) { return err }) require.NoError(t, err) - assert.Equal(t, expectYamlSingle, str) + assert.YAMLEq(t, expectYamlSingle, str) str, err = captureOutput(func() error { err := PrintResource(testResource, "json") return err }) require.NoError(t, err) - assert.Equal(t, expectJsonSingle, str) + assert.JSONEq(t, expectJsonSingle, str) err = PrintResource(testResource, "unknown") require.Error(t, err) @@ -116,28 +116,28 @@ func Test_PrintResourceList(t *testing.T) { return err }) require.NoError(t, err) - assert.Equal(t, expectYamlList, str) + assert.YAMLEq(t, expectYamlList, str) str, err = captureOutput(func() error { err := PrintResourceList(testResource, "json", false) return err }) require.NoError(t, err) - assert.Equal(t, expectJsonList, str) + assert.JSONEq(t, expectJsonList, str) str, err = captureOutput(func() error { err := PrintResourceList(testResource2, "yaml", true) return err }) require.NoError(t, err) - assert.Equal(t, expectYamlSingle, str) + assert.YAMLEq(t, expectYamlSingle, str) str, err = captureOutput(func() error { err := PrintResourceList(testResource2, "json", true) return err }) require.NoError(t, err) - assert.Equal(t, expectJsonSingle, str) + assert.JSONEq(t, expectJsonSingle, str) err = PrintResourceList(testResource, "unknown", false) require.Error(t, err) diff --git a/controller/appcontroller_test.go b/controller/appcontroller_test.go index 6ed07aba702e5..cf2c14c7e0447 100644 --- a/controller/appcontroller_test.go +++ b/controller/appcontroller_test.go @@ -2147,7 +2147,7 @@ func TestHelmValuesObjectHasReplaceStrategy(t *testing.T) { app, appModified) require.NoError(t, err) - assert.Equal(t, `{"status":{"sync":{"comparedTo":{"source":{"helm":{"valuesObject":{"key":["value-modified1"]}}}}}}}`, string(patch)) + assert.JSONEq(t, `{"status":{"sync":{"comparedTo":{"source":{"helm":{"valuesObject":{"key":["value-modified1"]}}}}}}}`, string(patch)) } func TestAppStatusIsReplaced(t *testing.T) { diff --git a/hack/installers/install-lint-tools.sh b/hack/installers/install-lint-tools.sh index 0692263df3a2b..5594fcd91a0a3 100755 --- a/hack/installers/install-lint-tools.sh +++ b/hack/installers/install-lint-tools.sh @@ -2,6 +2,6 @@ set -eux -o pipefail # renovate: datasource=go packageName=github.com/golangci/golangci-lint -GOLANGCI_LINT_VERSION=1.61.0 +GOLANGCI_LINT_VERSION=1.62.0 GO111MODULE=on go install "github.com/golangci/golangci-lint/cmd/golangci-lint@v${GOLANGCI_LINT_VERSION}" diff --git a/pkg/apis/application/v1alpha1/types_test.go b/pkg/apis/application/v1alpha1/types_test.go index 484467a8f7a6f..83f7028484395 100644 --- a/pkg/apis/application/v1alpha1/types_test.go +++ b/pkg/apis/application/v1alpha1/types_test.go @@ -3923,6 +3923,7 @@ func TestOptionalArrayEquality(t *testing.T) { err := json.Unmarshal([]byte(presentButEmpty), ¶m) require.NoError(t, err) jsonPresentButEmpty := param.OptionalArray + // nolint:testifylint require.Equal(t, &OptionalArray{Array: []string{}}, jsonPresentButEmpty) // We won't simulate the protobuf unmarshalling of an empty array parameter. By experimentation, this is how it's @@ -3966,6 +3967,7 @@ func TestOptionalMapEquality(t *testing.T) { err := json.Unmarshal([]byte(presentButEmpty), ¶m) require.NoError(t, err) jsonPresentButEmpty := param.OptionalMap + // nolint:testifylint require.Equal(t, &OptionalMap{Map: map[string]string{}}, jsonPresentButEmpty) // We won't simulate the protobuf unmarshalling of an empty map parameter. By experimentation, this is how it's diff --git a/server/application/application_test.go b/server/application/application_test.go index d4068b5c7675c..d543a84beb494 100644 --- a/server/application/application_test.go +++ b/server/application/application_test.go @@ -2114,7 +2114,7 @@ func TestSplitStatusPatch(t *testing.T) { otherFields := `{"operation":{"eee":"fff"},"spec":{"aaa":"bbb"},"status":{"ccc":"ddd"}}` nonStatus, status, err := splitStatusPatch([]byte(otherFields)) require.NoError(t, err) - assert.Equal(t, `{"operation":{"eee":"fff"},"spec":{"aaa":"bbb"}}`, string(nonStatus)) + assert.JSONEq(t, `{"operation":{"eee":"fff"},"spec":{"aaa":"bbb"}}`, string(nonStatus)) assert.Equal(t, statusPatch, string(status)) } } diff --git a/test/e2e/app_management_test.go b/test/e2e/app_management_test.go index 8a5896fbdc560..113d18b5969b7 100644 --- a/test/e2e/app_management_test.go +++ b/test/e2e/app_management_test.go @@ -489,7 +489,7 @@ func TestPatchValuesObject(t *testing.T) { Expect(NoConditions()). And(func(app *Application) { // Check that the patch was a success. - assert.Equal(t, `{"some":{"foo":"bar","new":"field"}}`, string(app.Spec.Source.Helm.ValuesObject.Raw)) + assert.JSONEq(t, `{"some":{"foo":"bar","new":"field"}}`, string(app.Spec.Source.Helm.ValuesObject.Raw)) }) } diff --git a/test/e2e/fixture/project/actions.go b/test/e2e/fixture/project/actions.go index 61a2ad90615fb..f4358366c847d 100644 --- a/test/e2e/fixture/project/actions.go +++ b/test/e2e/fixture/project/actions.go @@ -102,6 +102,6 @@ func (a *Actions) runCli(args ...string) { a.context.t.Helper() a.lastOutput, a.lastError = fixture.RunCli(args...) if !a.ignoreErrors { - require.Empty(a.context.t, a.lastError) + require.NoError(a.context.t, a.lastError) } } diff --git a/util/argo/diff/ignore_test.go b/util/argo/diff/ignore_test.go index d5eacd3a49228..90c7b0464d7b6 100644 --- a/util/argo/diff/ignore_test.go +++ b/util/argo/diff/ignore_test.go @@ -51,6 +51,7 @@ func TestIgnoreDiffConfig_HasIgnoreDifference(t *testing.T) { assert.True(t, ok) assert.NotNil(t, actual) assert.Equal(t, expectedManagedFields, actual.ManagedFieldsManagers) + // nolint:testifylint assert.Equal(t, expectedJSONPointers, actual.JSONPointers) assert.Equal(t, expectedJQExpression, actual.JQPathExpressions) }) @@ -72,6 +73,7 @@ func TestIgnoreDiffConfig_HasIgnoreDifference(t *testing.T) { assert.True(t, ok) assert.NotNil(t, actual) assert.Equal(t, expectedManagedFields, actual.ManagedFieldsManagers) + // nolint:testifylint assert.Equal(t, expectedJSONPointers, actual.JSONPointers) assert.Equal(t, expectedJQExpression, actual.JQPathExpressions) }) diff --git a/util/exec/exec_test.go b/util/exec/exec_test.go index 4597b7213ef23..c41ee100f55ad 100644 --- a/util/exec/exec_test.go +++ b/util/exec/exec_test.go @@ -32,13 +32,13 @@ func TestRun(t *testing.T) { func TestHideUsernamePassword(t *testing.T) { _, err := RunWithRedactor(exec.Command("helm registry login https://charts.bitnami.com/bitnami", "--username", "foo", "--password", "bar"), nil) - assert.NotEmpty(t, err) + require.Error(t, err) redactor := func(text string) string { return regexp.MustCompile("(--username|--password) [^ ]*").ReplaceAllString(text, "$1 ******") } _, err = RunWithRedactor(exec.Command("helm registry login https://charts.bitnami.com/bitnami", "--username", "foo", "--password", "bar"), redactor) - assert.NotEmpty(t, err) + require.Error(t, err) } func TestRunWithExecRunOpts(t *testing.T) { diff --git a/util/oidc/oidc_test.go b/util/oidc/oidc_test.go index 8332acaf98885..40c606dcd9671 100644 --- a/util/oidc/oidc_test.go +++ b/util/oidc/oidc_test.go @@ -79,7 +79,7 @@ func TestIDTokenClaims(t *testing.T) { values, err := url.ParseQuery(authCodeURL.RawQuery) require.NoError(t, err) - assert.Equal(t, "{\"id_token\":{\"groups\":{\"essential\":true}}}", values.Get("claims")) + assert.JSONEq(t, "{\"id_token\":{\"groups\":{\"essential\":true}}}", values.Get("claims")) } type fakeProvider struct{} diff --git a/util/settings/accounts_test.go b/util/settings/accounts_test.go index 1415ce226de3d..2ab477ba6a963 100644 --- a/util/settings/accounts_test.go +++ b/util/settings/accounts_test.go @@ -164,7 +164,7 @@ func TestAddAccount_AccountAdded(t *testing.T) { assert.Equal(t, "hash", string(secret.Data["accounts.test.password"])) assert.Equal(t, mTime.Format(time.RFC3339), string(secret.Data["accounts.test.passwordMtime"])) - assert.Equal(t, `[{"id":"123","iat":0}]`, string(secret.Data["accounts.test.tokens"])) + assert.JSONEq(t, `[{"id":"123","iat":0}]`, string(secret.Data["accounts.test.tokens"])) } func TestAddAccount_AlreadyExists(t *testing.T) { @@ -204,7 +204,7 @@ func TestUpdateAccount_SuccessfullyUpdated(t *testing.T) { assert.Equal(t, "hash", string(secret.Data["accounts.test.password"])) assert.Equal(t, mTime.Format(time.RFC3339), string(secret.Data["accounts.test.passwordMtime"])) - assert.Equal(t, `[{"id":"123","iat":0}]`, string(secret.Data["accounts.test.tokens"])) + assert.JSONEq(t, `[{"id":"123","iat":0}]`, string(secret.Data["accounts.test.tokens"])) } func TestUpdateAccount_UpdateAdminPassword(t *testing.T) {