From 65c71d2b8d7efc2d28005913d6e355740ed8ca51 Mon Sep 17 00:00:00 2001 From: Ryan Zhang Date: Mon, 28 Oct 2024 12:47:08 -0700 Subject: [PATCH] fix the test --- apis/cluster/v1beta1/zz_generated.deepcopy.go | 2 +- apis/placement/v1alpha1/zz_generated.deepcopy.go | 5 +++-- apis/placement/v1beta1/zz_generated.deepcopy.go | 2 +- apis/v1alpha1/zz_generated.deepcopy.go | 2 +- pkg/controllers/workgenerator/controller.go | 2 +- .../workgenerator/controller_integration_test.go | 8 +------- test/apis/v1alpha1/zz_generated.deepcopy.go | 2 +- test/e2e/rollout_test.go | 2 +- 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/apis/cluster/v1beta1/zz_generated.deepcopy.go b/apis/cluster/v1beta1/zz_generated.deepcopy.go index 6d06cb15b..6c25f0189 100644 --- a/apis/cluster/v1beta1/zz_generated.deepcopy.go +++ b/apis/cluster/v1beta1/zz_generated.deepcopy.go @@ -10,7 +10,7 @@ Licensed under the MIT license. package v1beta1 import ( - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/apis/placement/v1alpha1/zz_generated.deepcopy.go b/apis/placement/v1alpha1/zz_generated.deepcopy.go index d26fe49a5..1a3f72658 100644 --- a/apis/placement/v1alpha1/zz_generated.deepcopy.go +++ b/apis/placement/v1alpha1/zz_generated.deepcopy.go @@ -10,10 +10,11 @@ Licensed under the MIT license. package v1alpha1 import ( - "go.goms.io/fleet/apis/placement/v1beta1" - "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" + + "go.goms.io/fleet/apis/placement/v1beta1" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/apis/placement/v1beta1/zz_generated.deepcopy.go b/apis/placement/v1beta1/zz_generated.deepcopy.go index f20cf8be5..754effe01 100644 --- a/apis/placement/v1beta1/zz_generated.deepcopy.go +++ b/apis/placement/v1beta1/zz_generated.deepcopy.go @@ -10,7 +10,7 @@ Licensed under the MIT license. package v1beta1 import ( - "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" ) diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 0d4061551..ac4844274 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -11,7 +11,7 @@ package v1alpha1 import ( corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/pkg/controllers/workgenerator/controller.go b/pkg/controllers/workgenerator/controller.go index 90e3aba92..2c9d367c1 100644 --- a/pkg/controllers/workgenerator/controller.go +++ b/pkg/controllers/workgenerator/controller.go @@ -136,7 +136,6 @@ func (r *Reconciler) Reconcile(ctx context.Context, req controllerruntime.Reques workUpdated := false overrideSucceeded := false - resourceBinding.Status.FailedPlacements = nil // list all the corresponding works works, syncErr := r.listAllWorksAssociated(ctx, &resourceBinding) if syncErr == nil { @@ -147,6 +146,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req controllerruntime.Reques for i := condition.OverriddenCondition; i < condition.TotalCondition; i++ { resourceBinding.RemoveCondition(string(i.ResourceBindingConditionType())) } + resourceBinding.Status.FailedPlacements = nil if overrideSucceeded { overrideReason := condition.OverriddenSucceededReason overrideMessage := "Successfully applied the override rules on the resources" diff --git a/pkg/controllers/workgenerator/controller_integration_test.go b/pkg/controllers/workgenerator/controller_integration_test.go index ee3c34ff5..40e60c726 100644 --- a/pkg/controllers/workgenerator/controller_integration_test.go +++ b/pkg/controllers/workgenerator/controller_integration_test.go @@ -497,14 +497,8 @@ var _ = Describe("Test Work Generator Controller", func() { }, { Type: string(placementv1beta1.ResourceBindingOverridden), - Status: metav1.ConditionTrue, - Reason: condition.OverrideNotSpecifiedReason, - ObservedGeneration: binding.GetGeneration(), - }, - { - Type: string(placementv1beta1.ResourceBindingWorkSynchronized), Status: metav1.ConditionFalse, - Reason: condition.SyncWorkFailedReason, + Reason: condition.OverriddenFailedReason, ObservedGeneration: binding.GetGeneration(), }, }, diff --git a/test/apis/v1alpha1/zz_generated.deepcopy.go b/test/apis/v1alpha1/zz_generated.deepcopy.go index 0b5d2e30b..ef7e4433a 100644 --- a/test/apis/v1alpha1/zz_generated.deepcopy.go +++ b/test/apis/v1alpha1/zz_generated.deepcopy.go @@ -10,7 +10,7 @@ Licensed under the MIT license. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/test/e2e/rollout_test.go b/test/e2e/rollout_test.go index a87624bb8..1db441dfa 100644 --- a/test/e2e/rollout_test.go +++ b/test/e2e/rollout_test.go @@ -655,7 +655,7 @@ var _ = Describe("placing wrapped resources using a CRP", Ordered, func() { }) }) - FContext("Test a CRP place custom resource successfully, should wait to update resource on multiple member clusters", Ordered, func() { + Context("Test a CRP place custom resource successfully, should wait to update resource on multiple member clusters", Ordered, func() { crpName := fmt.Sprintf(crpNameTemplate, GinkgoParallelProcess()) workNamespace := appNamespace() var wantSelectedResources []placementv1beta1.ResourceIdentifier