diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 543f30b56..0042823f1 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -18,5 +18,5 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v4 with: - version: v1.55.2 + version: v1.57.2 args: --timeout 15m diff --git a/Makefile b/Makefile index 9472c9012..d8271dd28 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ CONTROLLER_GEN_VER := v0.14.0 CONTROLLER_GEN_BIN := controller-gen CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER) -GOLANGCI_LINT_VER := v1.55.2 +GOLANGCI_LINT_VER := v1.57.2 GOLANGCI_LINT_BIN := golangci-lint GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER) diff --git a/cmd/plugin/cmd/delete_test.go b/cmd/plugin/cmd/delete_test.go index dfc2ca464..6c2778b7c 100644 --- a/cmd/plugin/cmd/delete_test.go +++ b/cmd/plugin/cmd/delete_test.go @@ -65,6 +65,7 @@ func TestSelectorFromProvider(t *testing.T) { t.Run(tc.name, func(t *testing.T) { g := NewWithT(t) actual, err := selectorFromProvider(tc.provider) + if tc.expectedErr { g.Expect(err).To(HaveOccurred()) } else { diff --git a/cmd/plugin/cmd/init_test.go b/cmd/plugin/cmd/init_test.go index 0e6f93893..c9e60be85 100644 --- a/cmd/plugin/cmd/init_test.go +++ b/cmd/plugin/cmd/init_test.go @@ -107,7 +107,6 @@ func TestCheckCAPIOpearatorAvailability(t *testing.T) { if tt.wantErr { // To generate an error we create two deployments with the same labels. - // Deployment 1. deployment := generateCAPIOperatorDeployment("capi-operator-controller-manager", "default") resources = append(resources, deployment) diff --git a/cmd/plugin/cmd/utils.go b/cmd/plugin/cmd/utils.go index f802d195c..1322afaa9 100644 --- a/cmd/plugin/cmd/utils.go +++ b/cmd/plugin/cmd/utils.go @@ -223,6 +223,7 @@ func GetLatestRelease(ctx context.Context, repo repository.Repository) (string, if versionCandidates[j].PreRelease() == "" && versionCandidates[i].PreRelease() != "" { return false } + if versionCandidates[i].PreRelease() == "" && versionCandidates[j].PreRelease() != "" { return true } diff --git a/internal/controller/client_proxy.go b/internal/controller/client_proxy.go index e12119a43..606c0cfd3 100644 --- a/internal/controller/client_proxy.go +++ b/internal/controller/client_proxy.go @@ -197,7 +197,9 @@ func (k *controllerProxy) ListResources(ctx context.Context, labels map[string]s if err != nil { return nil, err } + klog.V(3).InfoS("listed", "kind", resourceKind.Kind, "count", len(objList.Items)) + ret = append(ret, objList.Items...) } } diff --git a/internal/controller/genericprovider_controller_test.go b/internal/controller/genericprovider_controller_test.go index fa619d19a..78f4ecce4 100644 --- a/internal/controller/genericprovider_controller_test.go +++ b/internal/controller/genericprovider_controller_test.go @@ -327,6 +327,7 @@ releaseSeries: if labels == nil { labels = map[string]string{} } + labels["provider-version"] = tc.newVersion provider.SetLabels(labels) diff --git a/internal/controller/phases_test.go b/internal/controller/phases_test.go index d4308d603..99e60e9d5 100644 --- a/internal/controller/phases_test.go +++ b/internal/controller/phases_test.go @@ -391,10 +391,12 @@ metadata: } got, err := p.configmapRepository(context.TODO(), p.provider.GetSpec().FetchConfig.Selector, "ns1", tt.additionalManifests) + if len(tt.wantErr) > 0 { g.Expect(err).Should(MatchError(tt.wantErr)) return } + g.Expect(err).To(Succeed()) gotComponents, err := got.GetFile(ctx, got.DefaultVersion(), got.ComponentsPath()) g.Expect(err).To(Succeed()) @@ -588,6 +590,7 @@ releaseSeries: for i := range tt.configMaps { g.Expect(fakeclient.Create(ctx, &tt.configMaps[i])).To(Succeed()) } + if tt.defaultRepository { var err error p.repo, err = p.configmapRepository(ctx, &metav1.LabelSelector{ @@ -606,14 +609,17 @@ releaseSeries: g.Expect(err).Should(MatchError(tt.wantErr)) return } + g.Expect(err).To(Succeed()) meta := got.Metadata(tt.wantDefaultVersion) metadataData, err := meta.Get(ctx) + if len(tt.metadataErr) > 0 { g.Expect(err).Should(MatchError(tt.metadataErr)) return } + g.Expect(err).To(Succeed()) g.Expect(metadataData.ReleaseSeries).To(Equal(tt.wantMetadataSeries)) diff --git a/internal/patch/patch_test.go b/internal/patch/patch_test.go index 5987ab2b6..79ee9e431 100644 --- a/internal/patch/patch_test.go +++ b/internal/patch/patch_test.go @@ -50,6 +50,7 @@ func TestApplyPatches(t *testing.T) { if tc.expectedError { g.Expect(err).To(HaveOccurred()) } + g.Expect(err).NotTo(HaveOccurred()) resultYaml, err := utilyaml.FromUnstructured(result) diff --git a/internal/webhook/provider_webhook_test.go b/internal/webhook/provider_webhook_test.go index 0d0792ad3..52d64408d 100644 --- a/internal/webhook/provider_webhook_test.go +++ b/internal/webhook/provider_webhook_test.go @@ -99,6 +99,7 @@ func TestSetDefaultProviderSpec(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { gs := NewWithT(t) + setDefaultProviderSpec(tc.providerSpec, tc.namespace) gs.Expect(reflect.DeepEqual(tc.providerSpec, tc.expectedProviderSpec)).To(BeTrue()) })