From 3e860f8a26811d5b447005da2d57ae7facd2ef52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilson=20J=C3=BAnior?= Date: Wed, 15 May 2024 16:27:21 -0300 Subject: [PATCH] Fix order of import --- controllers/skeleton.go | 7 ++++--- controllers/validation_controller.go | 11 ++++++----- controllers/validation_controller_test.go | 5 +++-- internal/pkg/rpaas/validation/manager.go | 5 +++-- internal/pkg/rpaas/validation/manager_test.go | 7 ++++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/controllers/skeleton.go b/controllers/skeleton.go index 4ec96a15..e506d2fc 100644 --- a/controllers/skeleton.go +++ b/controllers/skeleton.go @@ -10,13 +10,14 @@ import ( "sort" "github.com/sirupsen/logrus" - "github.com/tsuru/rpaas-operator/api/v1alpha1" - "github.com/tsuru/rpaas-operator/internal/pkg/rpaas/nginx" - "github.com/tsuru/rpaas-operator/pkg/util" corev1 "k8s.io/api/core/v1" k8sErrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/tsuru/rpaas-operator/api/v1alpha1" + "github.com/tsuru/rpaas-operator/internal/pkg/rpaas/nginx" + "github.com/tsuru/rpaas-operator/pkg/util" ) func listDefaultFlavors(ctx context.Context, c client.Client, namespace string) ([]v1alpha1.RpaasFlavor, error) { diff --git a/controllers/validation_controller.go b/controllers/validation_controller.go index 6799243f..f309900e 100644 --- a/controllers/validation_controller.go +++ b/controllers/validation_controller.go @@ -6,8 +6,6 @@ import ( "path/filepath" "github.com/go-logr/logr" - "github.com/tsuru/rpaas-operator/api/v1alpha1" - "github.com/tsuru/rpaas-operator/internal/pkg/rpaas/nginx" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" k8sErrors "k8s.io/apimachinery/pkg/api/errors" @@ -18,6 +16,9 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" + + "github.com/tsuru/rpaas-operator/api/v1alpha1" + "github.com/tsuru/rpaas-operator/internal/pkg/rpaas/nginx" ) // RpaasValidationReconciler reconciles a RpaasValidation object @@ -98,10 +99,10 @@ func (r *RpaasValidationReconciler) Reconcile(ctx context.Context, req ctrl.Requ } if existingPod != nil { - finished, err := r.finishValidation(ctx, existingPod, validation, validationHash) + finished, finishErr := r.finishValidation(ctx, existingPod, validation, validationHash) - if err != nil { - return ctrl.Result{}, err + if finishErr != nil { + return ctrl.Result{}, finishErr } if finished { diff --git a/controllers/validation_controller_test.go b/controllers/validation_controller_test.go index 3b9c4176..40484c10 100644 --- a/controllers/validation_controller_test.go +++ b/controllers/validation_controller_test.go @@ -11,8 +11,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" nginxv1alpha1 "github.com/tsuru/nginx-operator/api/v1alpha1" - "github.com/tsuru/rpaas-operator/api/v1alpha1" - extensionsruntime "github.com/tsuru/rpaas-operator/pkg/runtime" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -22,6 +20,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" + + "github.com/tsuru/rpaas-operator/api/v1alpha1" + extensionsruntime "github.com/tsuru/rpaas-operator/pkg/runtime" ) func TestNewValidationPod(t *testing.T) { diff --git a/internal/pkg/rpaas/validation/manager.go b/internal/pkg/rpaas/validation/manager.go index a20e045d..a6bfc559 100644 --- a/internal/pkg/rpaas/validation/manager.go +++ b/internal/pkg/rpaas/validation/manager.go @@ -8,13 +8,14 @@ import ( "fmt" "time" - "github.com/tsuru/rpaas-operator/api/v1alpha1" - "github.com/tsuru/rpaas-operator/internal/pkg/rpaas" corev1 "k8s.io/api/core/v1" k8sErrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/klog/v2" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/tsuru/rpaas-operator/api/v1alpha1" + "github.com/tsuru/rpaas-operator/internal/pkg/rpaas" ) var _ rpaas.RpaasManager = &validationManager{} diff --git a/internal/pkg/rpaas/validation/manager_test.go b/internal/pkg/rpaas/validation/manager_test.go index c724a985..89fba269 100644 --- a/internal/pkg/rpaas/validation/manager_test.go +++ b/internal/pkg/rpaas/validation/manager_test.go @@ -10,9 +10,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" nginxv1alpha1 "github.com/tsuru/nginx-operator/api/v1alpha1" - "github.com/tsuru/rpaas-operator/api/v1alpha1" - "github.com/tsuru/rpaas-operator/internal/pkg/rpaas" - "github.com/tsuru/rpaas-operator/internal/pkg/rpaas/fake" corev1 "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -21,6 +18,10 @@ import ( metricsv1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client" clientFake "sigs.k8s.io/controller-runtime/pkg/client/fake" + + "github.com/tsuru/rpaas-operator/api/v1alpha1" + "github.com/tsuru/rpaas-operator/internal/pkg/rpaas" + "github.com/tsuru/rpaas-operator/internal/pkg/rpaas/fake" ) func newScheme() *runtime.Scheme {