From 3ebca58381a63a00d989a2eef43214e3101a1bba Mon Sep 17 00:00:00 2001 From: Corey Daley Date: Fri, 10 May 2024 09:06:51 -0400 Subject: [PATCH 1/4] Configure go-imports-organizer --- Makefile | 28 +++++++++++++++------------- goio.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 goio.yaml diff --git a/Makefile b/Makefile index 355d0195..2f1eaafe 100644 --- a/Makefile +++ b/Makefile @@ -105,14 +105,18 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -.PHONY: fmt -fmt: goimports ## Format the code using goimports - find . -not -path '*/\.*' -name '*.go' -exec $(GOIMPORTS) -w {} \; - fmt_license: addlicense ## Ensure the license header is set on all files $(ADDLICENSE) -v -f license_header.txt $$(find . -not -path '*/\.*' -name '*.go') $(ADDLICENSE) -v -f license_header.txt $$(find . -name '*ockerfile') +.PHONY: imports +imports: addgoio ## Organize imports in go files using goio. + $(GOIO) + +.PHONY: verify-imports +verify-imports: addgoio ## Run import verifications. + $(GOIO) -l + .PHONY: gosec gosec: addgosec ## run the gosec scanner for non-test files in this repo # we let the report content trigger a failure using the GitHub Security features. @@ -223,20 +227,20 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen ENVTEST ?= $(LOCALBIN)/setup-envtest GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint -GOIMPORTS ?= $(LOCALBIN)/goimports ADDLICENSE ?= $(LOCALBIN)/addlicense GOSEC ?= $(LOCALBIN)/gosec +GOIO ?= $(LOCALBIN)/goio ## Tool Versions KUSTOMIZE_VERSION ?= v3.8.7 CONTROLLER_TOOLS_VERSION ?= v0.11.3 GOLANGCI_LINT_VERSION ?= v1.55.2 -GOIMPORTS_VERSION ?= v0.15.0 ADDLICENSE_VERSION ?= v1.1.1 # opm and operator-sdk version OPM_VERSION ?= v1.36.0 OPERATOR_SDK_VERSION ?= v1.33.0 GOSEC_VERSION ?= v2.18.2 +GOIO_VERSION ?= v1.4.0 ## Gosec options - default format is sarif so we can integrate with Github code scanning GOSEC_FMT ?= sarif # for other options, see https://github.com/securego/gosec#output-formats @@ -266,10 +270,10 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. $(GOLANGCI_LINT): $(LOCALBIN) test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) -.PHONY: goimports -goimports: $(GOIMPORTS) ## Download goimports locally if necessary. -$(GOIMPORTS): $(LOCALBIN) - test -s $(LOCALBIN)/goimports || GOBIN=$(LOCALBIN) go install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION) +.PHONY: addgoio +addgoio: $(GOIO) ## Download goio locally if necessary. +$(GOIO): $(LOCALBIN) + test -s $(LOCALBIN)/goio || GOBIN=$(LOCALBIN) go install github.com/go-imports-organizer/goio@$(GOIO_VERSION) .PHONY: addlicense addlicense: $(ADDLICENSE) ## Download addlicense locally if necessary. @@ -322,7 +326,7 @@ bundle: operator-sdk manifests kustomize ## Generate bundle manifests and metada ## to update the CSV with a new tagged version of the operator: ## yq '.spec.install.spec.deployments[0].spec.template.spec.containers[1].image|="quay.io/rhdh/operator:some-other-tag"' bundle/manifests/backstage-operator.clusterserviceversion.yaml -## or +## or ## sed -r -e "s#(image: +)quay.io/.+operator.+#\1quay.io/rhdh/operator:some-other-tag#g" -i bundle/manifests/backstage-operator.clusterserviceversion.yaml .PHONY: bundle-build bundle-build: ## Build the bundle image. @@ -413,5 +417,3 @@ show-img: show-container-engine: @echo -n $(CONTAINER_ENGINE) - - diff --git a/goio.yaml b/goio.yaml new file mode 100644 index 00000000..eda899f9 --- /dev/null +++ b/goio.yaml @@ -0,0 +1,26 @@ +excludes: + - matchtype: name + regexp: ^\.git$ + - matchtype: name + regexp: ^vendor$ +groups: + - description: standard + matchorder: 3 + regexp: + - ^[a-zA-Z0-9\/]+$ + - description: kubernetes + matchorder: 1 + regexp: + - ^k8s\.io|^sigs\.k8s\.io + - description: openshift + matchorder: 2 + regexp: + - ^github\.com\/openshift + - description: other + matchorder: 4 + regexp: + - '[a-zA-Z0-9]+\.[a-zA-Z0-9]+/' + - description: module + matchorder: 0 + regexp: + - "%{module}%" From 4efc0b2245aa8a25882e777f74553b5667577270 Mon Sep 17 00:00:00 2001 From: Corey Daley Date: Tue, 14 May 2024 15:15:20 -0400 Subject: [PATCH 2/4] Reconfigure make fmt --- Makefile | 4 ++++ hack/verify-gofmt.sh | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 hack/verify-gofmt.sh diff --git a/Makefile b/Makefile index 2f1eaafe..b4d82d11 100644 --- a/Makefile +++ b/Makefile @@ -105,6 +105,10 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." +.PHONY: fmt +fmt: ## Run go fmt verifications + hack/verify-gofmt.sh + fmt_license: addlicense ## Ensure the license header is set on all files $(ADDLICENSE) -v -f license_header.txt $$(find . -not -path '*/\.*' -name '*.go') $(ADDLICENSE) -v -f license_header.txt $$(find . -name '*ockerfile') diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh new file mode 100755 index 00000000..08ca2ae4 --- /dev/null +++ b/hack/verify-gofmt.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +function list_go_src_files() { + find . -not \( \ + \( \ + -wholename './_output' \ + -o -wholename './.*' \ + -o -wholename '*/vendor/*' \ + \) -prune \ + \) -name '*.go' | sort -u +} + + +bad_files=$(list_go_src_files | xargs gofmt -s -l) +if [[ -n "${bad_files}" ]]; then + echo "!!! gofmt needs to be run on the listed files" + echo "${bad_files}" + echo "Try running 'gofmt -s -w [path]'" + exit 1 +fi From 79fffaa445527b733a3257b0a6a3816a6f83f753 Mon Sep 17 00:00:00 2001 From: Corey Daley Date: Tue, 14 May 2024 15:23:22 -0400 Subject: [PATCH 3/4] Add make imports check to pull requests --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b4d82d11..68f6aae8 100644 --- a/Makefile +++ b/Makefile @@ -135,12 +135,12 @@ vet: ## Run go vet against code. go vet ./... .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. We need LOCALBIN=$(LOCALBIN) to get correct default-config path +test: manifests generate verify-imports fmt vet envtest ## Run tests. We need LOCALBIN=$(LOCALBIN) to get correct default-config path mkdir -p $(LOCALBIN)/default-config && cp config/manager/$(CONF_DIR)/* $(LOCALBIN)/default-config LOCALBIN=$(LOCALBIN) KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(PKGS) -coverprofile cover.out .PHONY: integration-test -integration-test: ginkgo manifests generate fmt vet envtest ## Run integration_tests. We need LOCALBIN=$(LOCALBIN) to get correct default-config path +integration-test: ginkgo manifests generate verify-imports fmt vet envtest ## Run integration_tests. We need LOCALBIN=$(LOCALBIN) to get correct default-config path mkdir -p $(LOCALBIN)/default-config && cp config/manager/$(CONF_DIR)/* $(LOCALBIN)/default-config LOCALBIN=$(LOCALBIN) KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" $(GINKGO) -v -r $(ARGS) integration_tests @@ -148,11 +148,11 @@ integration-test: ginkgo manifests generate fmt vet envtest ## Run integration_t ##@ Build .PHONY: build -build: generate fmt vet ## Build manager binary. +build: generate verify-imports fmt vet ## Build manager binary. go build -o bin/manager main.go .PHONY: run -run: manifests generate fmt vet build ## Run a controller from your host. +run: manifests generate verify-imports fmt vet build ## Run a controller from your host. cd $(LOCALBIN) && mkdir -p default-config && cp ../config/manager/$(CONF_DIR)/* default-config && ./manager # by default images expire from quay registry after 14 days From da6432f728cc23b5185e955c10781a149f090706 Mon Sep 17 00:00:00 2001 From: Corey Daley Date: Tue, 11 Jun 2024 09:42:05 -0400 Subject: [PATCH 4/4] organizing imports --- controllers/backstage_controller.go | 32 +++++++---------- controllers/preprocessor_test.go | 8 +++-- controllers/spec_preprocessor.go | 10 ++---- integration_tests/config-refresh_test.go | 16 ++++----- integration_tests/cr-config_test.go | 18 ++++------ integration_tests/db_test.go | 17 ++++----- integration_tests/default-config_test.go | 14 +++----- integration_tests/matchers.go | 3 +- integration_tests/rhdh-config_test.go | 11 +++--- integration_tests/route_test.go | 11 +++--- integration_tests/suite_test.go | 44 +++++++++--------------- integration_tests/utils.go | 7 ++-- main.go | 9 ++--- pkg/model/appconfig.go | 5 ++- pkg/model/appconfig_test.go | 12 +++---- pkg/model/configmapenvs.go | 6 ++-- pkg/model/configmapenvs_test.go | 8 ++--- pkg/model/configmapfiles.go | 5 ++- pkg/model/configmapfiles_test.go | 7 ++-- pkg/model/db-secret.go | 6 ++-- pkg/model/db-secret_test.go | 7 ++-- pkg/model/db-service.go | 6 ++-- pkg/model/db-statefulset.go | 5 ++- pkg/model/db-statefulset_test.go | 8 ++--- pkg/model/deployment.go | 9 ++--- pkg/model/deployment_test.go | 7 ++-- pkg/model/dynamic-plugins.go | 5 ++- pkg/model/dynamic-plugins_test.go | 9 +++-- pkg/model/interfaces.go | 4 +-- pkg/model/model_tests.go | 7 ++-- pkg/model/route.go | 7 ++-- pkg/model/route_test.go | 9 +++-- pkg/model/runtime.go | 3 -- pkg/model/runtime_test.go | 8 ++--- pkg/model/secretenvs.go | 6 ++-- pkg/model/secretfiles.go | 5 ++- pkg/model/secretfiles_test.go | 7 ++-- pkg/model/service.go | 6 ++-- pkg/utils/pod-mutator.go | 3 +- pkg/utils/utils.go | 3 +- tests/e2e/e2e_suite_test.go | 4 +-- tests/e2e/e2e_test.go | 4 +-- tests/helper/helper_backstage.go | 3 +- tests/helper/utils.go | 5 +-- 44 files changed, 158 insertions(+), 231 deletions(-) diff --git a/controllers/backstage_controller.go b/controllers/backstage_controller.go index 152c7451..0563a16d 100644 --- a/controllers/backstage_controller.go +++ b/controllers/backstage_controller.go @@ -19,35 +19,27 @@ import ( "fmt" "reflect" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "k8s.io/apimachinery/pkg/runtime/schema" - - "k8s.io/apimachinery/pkg/types" - openshift "github.com/openshift/api/route/v1" - "k8s.io/apimachinery/pkg/api/meta" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - corev1 "k8s.io/api/core/v1" - - appsv1 "k8s.io/api/apps/v1" - - "redhat-developer/red-hat-developer-hub-operator/pkg/model" - bs "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" + "redhat-developer/red-hat-developer-hub-operator/pkg/model" ) var watchedConfigSelector = metav1.LabelSelector{ diff --git a/controllers/preprocessor_test.go b/controllers/preprocessor_test.go index 51e2db3a..f241e054 100644 --- a/controllers/preprocessor_test.go +++ b/controllers/preprocessor_test.go @@ -17,14 +17,16 @@ package controller import ( "context" "os" - "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/model" "testing" - "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + + "github.com/stretchr/testify/assert" + + "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/model" ) func updateConfigMap(t *testing.T) BackstageReconciler { diff --git a/controllers/spec_preprocessor.go b/controllers/spec_preprocessor.go index 12b33099..1debe69c 100644 --- a/controllers/spec_preprocessor.go +++ b/controllers/spec_preprocessor.go @@ -20,18 +20,14 @@ import ( "os" "strconv" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" - - "sigs.k8s.io/controller-runtime/pkg/log" - + "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/log" bs "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/model" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" ) const AutoSyncEnvVar = "EXT_CONF_SYNC_backstage" diff --git a/integration_tests/config-refresh_test.go b/integration_tests/config-refresh_test.go index d8feb801..d88843b9 100644 --- a/integration_tests/config-refresh_test.go +++ b/integration_tests/config-refresh_test.go @@ -17,24 +17,20 @@ package integration_tests import ( "context" "fmt" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" "strings" "time" - "sigs.k8s.io/controller-runtime/pkg/client" - - corev1 "k8s.io/api/core/v1" - appsv1 "k8s.io/api/apps/v1" - - "redhat-developer/red-hat-developer-hub-operator/pkg/model" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/model" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) var _ = When("create backstage with external configuration", func() { diff --git a/integration_tests/cr-config_test.go b/integration_tests/cr-config_test.go index 0c98a691..a208bb19 100644 --- a/integration_tests/cr-config_test.go +++ b/integration_tests/cr-config_test.go @@ -18,24 +18,18 @@ import ( "context" "time" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - + "k8s.io/apimachinery/pkg/types" "k8s.io/utils/ptr" - - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - appsv1 "k8s.io/api/apps/v1" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - "redhat-developer/red-hat-developer-hub-operator/pkg/model" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - - "k8s.io/apimachinery/pkg/types" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/model" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) var _ = When("create backstage with CR configured", func() { diff --git a/integration_tests/db_test.go b/integration_tests/db_test.go index 7ee45983..f0cb94e7 100644 --- a/integration_tests/db_test.go +++ b/integration_tests/db_test.go @@ -19,23 +19,18 @@ import ( "fmt" "time" - "redhat-developer/red-hat-developer-hub-operator/pkg/model" - + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/types" "k8s.io/utils/ptr" - - corev1 "k8s.io/api/core/v1" - - appsv1 "k8s.io/api/apps/v1" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - - "k8s.io/apimachinery/pkg/types" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/model" ) var _ = When("create backstage with CR configured", func() { diff --git a/integration_tests/default-config_test.go b/integration_tests/default-config_test.go index 9f8820a0..a0a6cdf3 100644 --- a/integration_tests/default-config_test.go +++ b/integration_tests/default-config_test.go @@ -19,21 +19,17 @@ import ( "fmt" "time" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - "redhat-developer/red-hat-developer-hub-operator/pkg/model" - appsv1 "k8s.io/api/apps/v1" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/reconcile" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/model" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) var _ = When("create default backstage", func() { diff --git a/integration_tests/matchers.go b/integration_tests/matchers.go index 0c98dd33..1c7dcba9 100644 --- a/integration_tests/matchers.go +++ b/integration_tests/matchers.go @@ -17,9 +17,10 @@ package integration_tests import ( "fmt" + corev1 "k8s.io/api/core/v1" + "github.com/onsi/gomega/format" "github.com/onsi/gomega/types" - corev1 "k8s.io/api/core/v1" ) // Matcher for Container VolumeMounts diff --git a/integration_tests/rhdh-config_test.go b/integration_tests/rhdh-config_test.go index bb702e46..d5313bc2 100644 --- a/integration_tests/rhdh-config_test.go +++ b/integration_tests/rhdh-config_test.go @@ -18,19 +18,16 @@ import ( "context" "time" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - appsv1 "k8s.io/api/apps/v1" - - "redhat-developer/red-hat-developer-hub-operator/pkg/model" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/model" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) var _ = When("create default backstage", func() { diff --git a/integration_tests/route_test.go b/integration_tests/route_test.go index 404c0e5d..3537fc5b 100644 --- a/integration_tests/route_test.go +++ b/integration_tests/route_test.go @@ -16,19 +16,18 @@ package integration_tests import ( "context" - "redhat-developer/red-hat-developer-hub-operator/pkg/model" "time" - openshift "github.com/openshift/api/route/v1" - + "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/reconcile" - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - - "k8s.io/apimachinery/pkg/types" + openshift "github.com/openshift/api/route/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/model" ) var _ = When("create default backstage", func() { diff --git a/integration_tests/suite_test.go b/integration_tests/suite_test.go index 8d708b37..f9726347 100644 --- a/integration_tests/suite_test.go +++ b/integration_tests/suite_test.go @@ -18,45 +18,35 @@ import ( "context" "fmt" "os" - "strconv" - - "k8s.io/apimachinery/pkg/api/errors" - - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/reconcile" - - "k8s.io/utils/ptr" - - openshift "github.com/openshift/api/route/v1" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - corev1 "k8s.io/api/core/v1" - "path/filepath" + "strconv" "testing" "time" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - controller "redhat-developer/red-hat-developer-hub-operator/controllers" - + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/rand" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" + "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" - + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" + logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + + openshift "github.com/openshift/api/route/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/util/rand" bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" + controller "redhat-developer/red-hat-developer-hub-operator/controllers" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" //+kubebuilder:scaffold:imports ) diff --git a/integration_tests/utils.go b/integration_tests/utils.go index 1d99443e..a4ca1b70 100644 --- a/integration_tests/utils.go +++ b/integration_tests/utils.go @@ -21,17 +21,16 @@ import ( "os" "path/filepath" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/remotecommand" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" - //. "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + //. "github.com/onsi/ginkgo/v2" ) func generateConfigMap(ctx context.Context, k8sClient client.Client, name string, namespace string, data, labels map[string]string, annotations map[string]string) string { diff --git a/main.go b/main.go index 7a954211..3b466ba5 100644 --- a/main.go +++ b/main.go @@ -20,24 +20,21 @@ import ( "flag" "os" - // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) - // to ensure that exec-entrypoint and run can make use of them. - _ "k8s.io/client-go/plugin/pkg/client/auth" - "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/discovery" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + _ "k8s.io/client-go/plugin/pkg/client/auth" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/healthz" "sigs.k8s.io/controller-runtime/pkg/log/zap" metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" "sigs.k8s.io/controller-runtime/pkg/webhook" + openshift "github.com/openshift/api/route/v1" + backstageiov1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" controller "redhat-developer/red-hat-developer-hub-operator/controllers" - - openshift "github.com/openshift/api/route/v1" //+kubebuilder:scaffold:imports ) diff --git a/pkg/model/appconfig.go b/pkg/model/appconfig.go index 93eaa0e9..51c52479 100644 --- a/pkg/model/appconfig.go +++ b/pkg/model/appconfig.go @@ -18,12 +18,11 @@ import ( "path/filepath" appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "sigs.k8s.io/controller-runtime/pkg/client" bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - corev1 "k8s.io/api/core/v1" - "sigs.k8s.io/controller-runtime/pkg/client" ) type AppConfigFactory struct{} diff --git a/pkg/model/appconfig_test.go b/pkg/model/appconfig_test.go index 835a9931..baf902ea 100644 --- a/pkg/model/appconfig_test.go +++ b/pkg/model/appconfig_test.go @@ -16,17 +16,15 @@ package model import ( "context" - - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "testing" corev1 "k8s.io/api/core/v1" - - "testing" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/stretchr/testify/assert" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) var ( diff --git a/pkg/model/configmapenvs.go b/pkg/model/configmapenvs.go index 205aaa13..70d88c3f 100644 --- a/pkg/model/configmapenvs.go +++ b/pkg/model/configmapenvs.go @@ -15,12 +15,12 @@ package model import ( - "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) type ConfigMapEnvsFactory struct{} diff --git a/pkg/model/configmapenvs_test.go b/pkg/model/configmapenvs_test.go index aa3b4846..ca1fa206 100644 --- a/pkg/model/configmapenvs_test.go +++ b/pkg/model/configmapenvs_test.go @@ -18,15 +18,13 @@ import ( "context" "testing" - "k8s.io/utils/ptr" - corev1 "k8s.io/api/core/v1" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" "github.com/stretchr/testify/assert" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" ) func TestDefaultConfigMapEnvFrom(t *testing.T) { diff --git a/pkg/model/configmapfiles.go b/pkg/model/configmapfiles.go index 1977987a..bf4c7493 100644 --- a/pkg/model/configmapfiles.go +++ b/pkg/model/configmapfiles.go @@ -16,12 +16,11 @@ package model import ( appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "sigs.k8s.io/controller-runtime/pkg/client" "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - corev1 "k8s.io/api/core/v1" - "sigs.k8s.io/controller-runtime/pkg/client" ) type ConfigMapFilesFactory struct{} diff --git a/pkg/model/configmapfiles_test.go b/pkg/model/configmapfiles_test.go index 9dedb06a..c69962b3 100644 --- a/pkg/model/configmapfiles_test.go +++ b/pkg/model/configmapfiles_test.go @@ -16,14 +16,13 @@ package model import ( "context" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "testing" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "testing" - "github.com/stretchr/testify/assert" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" ) var ( diff --git a/pkg/model/db-secret.go b/pkg/model/db-secret.go index f6c3d7d3..70910a54 100644 --- a/pkg/model/db-secret.go +++ b/pkg/model/db-secret.go @@ -17,11 +17,11 @@ package model import ( "strconv" - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) type DbSecretFactory struct{} diff --git a/pkg/model/db-secret_test.go b/pkg/model/db-secret_test.go index 96f4ce1d..4308f17b 100644 --- a/pkg/model/db-secret_test.go +++ b/pkg/model/db-secret_test.go @@ -19,13 +19,12 @@ import ( "fmt" "testing" - "k8s.io/utils/ptr" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" "github.com/stretchr/testify/assert" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" ) var dbSecretBackstage = &bsv1alpha1.Backstage{ diff --git a/pkg/model/db-service.go b/pkg/model/db-service.go index fb47c7c4..23f4a177 100644 --- a/pkg/model/db-service.go +++ b/pkg/model/db-service.go @@ -17,11 +17,11 @@ package model import ( "fmt" - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) type DbServiceFactory struct{} diff --git a/pkg/model/db-statefulset.go b/pkg/model/db-statefulset.go index c47bdec2..eaa042d4 100644 --- a/pkg/model/db-statefulset.go +++ b/pkg/model/db-statefulset.go @@ -18,13 +18,12 @@ import ( "fmt" "os" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + "sigs.k8s.io/controller-runtime/pkg/client" bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - appsv1 "k8s.io/api/apps/v1" - "sigs.k8s.io/controller-runtime/pkg/client" ) const LocalDbImageEnvVar = "RELATED_IMAGE_postgresql" diff --git a/pkg/model/db-statefulset_test.go b/pkg/model/db-statefulset_test.go index 699ee377..c4a9f950 100644 --- a/pkg/model/db-statefulset_test.go +++ b/pkg/model/db-statefulset_test.go @@ -20,14 +20,12 @@ import ( "testing" corev1 "k8s.io/api/core/v1" - - "k8s.io/utils/ptr" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" "github.com/stretchr/testify/assert" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" ) var dbStatefulSetBackstage = &bsv1alpha1.Backstage{ diff --git a/pkg/model/deployment.go b/pkg/model/deployment.go index 39ef9d98..37bf2e0d 100644 --- a/pkg/model/deployment.go +++ b/pkg/model/deployment.go @@ -18,16 +18,13 @@ import ( "fmt" "os" - "k8s.io/utils/ptr" - + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + "k8s.io/utils/ptr" + "sigs.k8s.io/controller-runtime/pkg/client" bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - appsv1 "k8s.io/api/apps/v1" - "sigs.k8s.io/controller-runtime/pkg/client" ) const BackstageImageEnvVar = "RELATED_IMAGE_backstage" diff --git a/pkg/model/deployment_test.go b/pkg/model/deployment_test.go index 261ceb86..febc41c9 100644 --- a/pkg/model/deployment_test.go +++ b/pkg/model/deployment_test.go @@ -18,13 +18,12 @@ import ( "context" "testing" - "k8s.io/utils/ptr" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" "github.com/stretchr/testify/assert" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" ) var deploymentTestBackstage = bsv1alpha1.Backstage{ diff --git a/pkg/model/dynamic-plugins.go b/pkg/model/dynamic-plugins.go index f55dbd5c..73016345 100644 --- a/pkg/model/dynamic-plugins.go +++ b/pkg/model/dynamic-plugins.go @@ -19,12 +19,11 @@ import ( "os" appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "sigs.k8s.io/controller-runtime/pkg/client" "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - corev1 "k8s.io/api/core/v1" - "sigs.k8s.io/controller-runtime/pkg/client" ) const dynamicPluginInitContainerName = "install-dynamic-plugins" diff --git a/pkg/model/dynamic-plugins_test.go b/pkg/model/dynamic-plugins_test.go index 5bac21c0..9037f173 100644 --- a/pkg/model/dynamic-plugins_test.go +++ b/pkg/model/dynamic-plugins_test.go @@ -16,17 +16,16 @@ package model import ( "context" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" "testing" - "k8s.io/utils/ptr" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" "github.com/stretchr/testify/assert" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) var testDynamicPluginsBackstage = bsv1alpha1.Backstage{ diff --git a/pkg/model/interfaces.go b/pkg/model/interfaces.go index 859ce115..702880eb 100644 --- a/pkg/model/interfaces.go +++ b/pkg/model/interfaces.go @@ -15,10 +15,10 @@ package model import ( - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - appsv1 "k8s.io/api/apps/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" ) // Registered Object configuring Backstage runtime model diff --git a/pkg/model/model_tests.go b/pkg/model/model_tests.go index 3948d2c8..943b8849 100644 --- a/pkg/model/model_tests.go +++ b/pkg/model/model_tests.go @@ -19,13 +19,10 @@ import ( "os" "path/filepath" - "k8s.io/utils/ptr" - corev1 "k8s.io/api/core/v1" - - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/utils/ptr" bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" ) diff --git a/pkg/model/route.go b/pkg/model/route.go index 56601949..995ff93a 100644 --- a/pkg/model/route.go +++ b/pkg/model/route.go @@ -15,11 +15,12 @@ package model import ( - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" + "sigs.k8s.io/controller-runtime/pkg/client" openshift "github.com/openshift/api/route/v1" - "sigs.k8s.io/controller-runtime/pkg/client" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) type BackstageRouteFactory struct{} diff --git a/pkg/model/route_test.go b/pkg/model/route_test.go index c035af39..24df3e50 100644 --- a/pkg/model/route_test.go +++ b/pkg/model/route_test.go @@ -18,15 +18,14 @@ import ( "context" "testing" - openshift "github.com/openshift/api/route/v1" - - "k8s.io/utils/ptr" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + openshift "github.com/openshift/api/route/v1" "github.com/stretchr/testify/assert" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" ) func TestDefaultRoute(t *testing.T) { diff --git a/pkg/model/runtime.go b/pkg/model/runtime.go index 82f3f3db..863f2abf 100644 --- a/pkg/model/runtime.go +++ b/pkg/model/runtime.go @@ -23,14 +23,11 @@ import ( "sort" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - "sigs.k8s.io/controller-runtime/pkg/log" bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) diff --git a/pkg/model/runtime_test.go b/pkg/model/runtime_test.go index 3f5354cb..dd04d601 100644 --- a/pkg/model/runtime_test.go +++ b/pkg/model/runtime_test.go @@ -17,17 +17,15 @@ package model import ( "context" "fmt" - "testing" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" + "github.com/stretchr/testify/assert" + "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/stretchr/testify/assert" ) func TestIfEmptyObjectsContainTypeinfo(t *testing.T) { diff --git a/pkg/model/secretenvs.go b/pkg/model/secretenvs.go index a6277351..751305ee 100644 --- a/pkg/model/secretenvs.go +++ b/pkg/model/secretenvs.go @@ -15,13 +15,13 @@ package model import ( - "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) type SecretEnvsFactory struct{} diff --git a/pkg/model/secretfiles.go b/pkg/model/secretfiles.go index 17430ab3..72506cf2 100644 --- a/pkg/model/secretfiles.go +++ b/pkg/model/secretfiles.go @@ -18,13 +18,12 @@ import ( "fmt" appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - corev1 "k8s.io/api/core/v1" - "sigs.k8s.io/controller-runtime/pkg/client" ) type SecretFilesFactory struct{} diff --git a/pkg/model/secretfiles_test.go b/pkg/model/secretfiles_test.go index 4a95110f..1658e680 100644 --- a/pkg/model/secretfiles_test.go +++ b/pkg/model/secretfiles_test.go @@ -18,13 +18,12 @@ import ( "context" "testing" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/stretchr/testify/assert" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) var ( diff --git a/pkg/model/service.go b/pkg/model/service.go index 519a77d6..e45be543 100644 --- a/pkg/model/service.go +++ b/pkg/model/service.go @@ -17,11 +17,11 @@ package model import ( "fmt" - bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" - "redhat-developer/red-hat-developer-hub-operator/pkg/utils" - corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + bsv1alpha1 "redhat-developer/red-hat-developer-hub-operator/api/v1alpha1" + "redhat-developer/red-hat-developer-hub-operator/pkg/utils" ) type BackstageServiceFactory struct{} diff --git a/pkg/utils/pod-mutator.go b/pkg/utils/pod-mutator.go index c6c62e4d..d14df912 100644 --- a/pkg/utils/pod-mutator.go +++ b/pkg/utils/pod-mutator.go @@ -17,9 +17,8 @@ package utils import ( "path/filepath" - "k8s.io/utils/ptr" - corev1 "k8s.io/api/core/v1" + "k8s.io/utils/ptr" ) const ( diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 585c342d..f7b07fb9 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -24,10 +24,9 @@ import ( "regexp" "strings" + "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/client-go/discovery" ctrl "sigs.k8s.io/controller-runtime" - - "k8s.io/apimachinery/pkg/util/yaml" ) const maxK8sResourceNameLength = 63 diff --git a/tests/e2e/e2e_suite_test.go b/tests/e2e/e2e_suite_test.go index 042ae386..17ce755d 100644 --- a/tests/e2e/e2e_suite_test.go +++ b/tests/e2e/e2e_suite_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" - "redhat-developer/red-hat-developer-hub-operator/tests/helper" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + "redhat-developer/red-hat-developer-hub-operator/tests/helper" ) const ( diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index b2db9d4f..41c2bb0f 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -21,10 +21,10 @@ import ( "strconv" "time" - "redhat-developer/red-hat-developer-hub-operator/tests/helper" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + "redhat-developer/red-hat-developer-hub-operator/tests/helper" ) var _ = Describe("Backstage Operator E2E", func() { diff --git a/tests/helper/helper_backstage.go b/tests/helper/helper_backstage.go index 94532e11..e7e66d4e 100644 --- a/tests/helper/helper_backstage.go +++ b/tests/helper/helper_backstage.go @@ -20,12 +20,13 @@ import ( "io" "net/http" "os/exec" - "redhat-developer/red-hat-developer-hub-operator/pkg/model" "strings" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/onsi/gomega/types" + + "redhat-developer/red-hat-developer-hub-operator/pkg/model" ) type ApiEndpointTest struct { diff --git a/tests/helper/utils.go b/tests/helper/utils.go index 8e3f9368..522da4fb 100644 --- a/tests/helper/utils.go +++ b/tests/helper/utils.go @@ -23,11 +23,12 @@ import ( "strconv" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/util/rand" "k8s.io/client-go/discovery" ctrl "sigs.k8s.io/controller-runtime" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz0123456789")