Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable linter for ./test/... and fix findings #70

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ check-generate:

.PHONY: check
check: $(GOIMPORTS) $(GOLANGCI_LINT) $(HELM)
@bash $(GARDENER_HACK_DIR)/check.sh --golangci-lint-config=./.golangci.yaml ./cmd/... ./pkg/... # ./test/... # TODO(vpnachev): uncomment when tests are implemented
@bash $(GARDENER_HACK_DIR)/check.sh --golangci-lint-config=./.golangci.yaml ./cmd/... ./pkg/... ./test/...
@bash $(GARDENER_HACK_DIR)/check-charts.sh ./charts

.PHONY: generate
Expand Down
18 changes: 10 additions & 8 deletions test/system/lifecycle/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/client-go/rest"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
)

Expand All @@ -59,10 +60,10 @@ var _ = Describe("Shoot lakom service testing", func() {

AfterEach(func() {
// Revert to initial extension configuration
f.UpdateShoot(context.Background(), func(shoot *gardencorev1beta1.Shoot) error {
Expect(f.UpdateShoot(context.Background(), func(shoot *gardencorev1beta1.Shoot) error {
shoot.Spec.Extensions = initialExtensionConfig
return nil
})
})).To(Succeed())
})

f.Serial().Beta().CIt("Should perform the common case scenario without any errors", func(ctx context.Context) {
Expand Down Expand Up @@ -182,7 +183,7 @@ var _ = Describe("Shoot lakom service testing", func() {
}

// Ensure that the Lakom service is disabled in order to verify the deletion process
f.UpdateShoot(ctx, ensureLakomServiceIsEnabled)
Expect(f.UpdateShoot(ctx, ensureLakomServiceIsDisabled)).To(Succeed())

// Ensure that lakom deployment is deleted
err = f.SeedClient.Client().Get(ctx, client.ObjectKeyFromObject(lakomDeployment), lakomDeployment)
Expand Down Expand Up @@ -211,23 +212,23 @@ func ensureLakomServiceIsEnabled(shoot *gardencorev1beta1.Shoot) error {
for i, e := range shoot.Spec.Extensions {
if e.Type == constants.ExtensionType {
if e.Disabled != nil && *e.Disabled == true {
shoot.Spec.Extensions[i].Disabled = ptr[bool](false)
shoot.Spec.Extensions[i].Disabled = ptr.To[bool](false)
}
return nil
}
}

shoot.Spec.Extensions = append(shoot.Spec.Extensions, gardencorev1beta1.Extension{
Type: constants.ExtensionType,
Disabled: ptr[bool](false),
Disabled: ptr.To[bool](false),
})
return nil
}

func ensureLakomServiceIsDisabled(shoot *gardencorev1beta1.Shoot) error {
for i, e := range shoot.Spec.Extensions {
if e.Type == constants.ExtensionType {
shoot.Spec.Extensions[i].Disabled = ptr[bool](true)
shoot.Spec.Extensions[i].Disabled = ptr.To[bool](true)
return nil
}
}
Expand Down Expand Up @@ -265,7 +266,7 @@ func getJWKS(ctx context.Context, client rest.Interface, relativeUri string) ([]
}

func requestAPIServer(ctx context.Context, caBundle []byte, apiserverURL, bearerToken string) (*metav1.Status, error) {
req, err := http.NewRequest("GET", apiserverURL, nil)
req, err := http.NewRequestWithContext(ctx, "GET", apiserverURL, nil)
if err != nil {
return nil, err
}
Expand All @@ -276,7 +277,8 @@ func requestAPIServer(ctx context.Context, caBundle []byte, apiserverURL, bearer
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
RootCAs: caCertPool,
RootCAs: caCertPool,
MinVersion: tls.VersionTLS12,
vpnachev marked this conversation as resolved.
Show resolved Hide resolved
},
},
}
Expand Down