Skip to content

Commit 832acf4

Browse files
author
Arvind Thirumurugan
committed
fix validation UTs
Signed-off-by: Arvind Thirumurugan <[email protected]>
1 parent 0fb6f10 commit 832acf4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pkg/controllers/updaterun/initialization.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ func (r *Reconciler) collectScheduledClusters(
250250
}
251251
} else {
252252
if bindingSpec.State != placementv1beta1.BindingStateUnscheduled {
253-
stateErr := fmt.Errorf("binding `%s/%s` with old policy snapshot `%s/%s` has state %s, we might observe a transient state, need retry",
254-
binding.GetNamespace() ,binding.GetName(), binding.GetNamespace(), bindingSpec.SchedulingPolicySnapshotName, bindingSpec.State)
253+
stateErr := fmt.Errorf("binding `%s/%s` with old policy snapshot `%s/%s` has state %s, we might observe a transient state, need retry",
254+
binding.GetNamespace(), binding.GetName(), binding.GetNamespace(), bindingSpec.SchedulingPolicySnapshotName, bindingSpec.State)
255255

256256
klog.V(2).InfoS("Found a not-unscheduled binding with old policy snapshot, retrying", "binding", bindingRef, "placement", placementKey,
257257
"latestPolicySnapshotObj", policySnapshotRef, "stagedUpdateRunObj", updateRunRef)

pkg/controllers/updaterun/validation_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func TestValidateDeleteStageStatus(t *testing.T) {
244244
name string
245245
updatingStageIndex int
246246
lastFinishedStageIndex int
247-
toBeDeletedBindings []*placementv1beta1.ClusterResourceBinding
247+
toBeDeletedBindings []placementv1beta1.BindingObj
248248
deleteStageStatus *placementv1beta1.StageUpdatingStatus
249249
wantErr error
250250
wantUpdatingStageIndex int
@@ -257,12 +257,12 @@ func TestValidateDeleteStageStatus(t *testing.T) {
257257
},
258258
{
259259
name: "validateDeleteStageStatus should return error if there's new to-be-deleted bindings",
260-
toBeDeletedBindings: []*placementv1beta1.ClusterResourceBinding{
261-
{
260+
toBeDeletedBindings: []placementv1beta1.BindingObj{
261+
&placementv1beta1.ClusterResourceBinding{
262262
ObjectMeta: metav1.ObjectMeta{Name: "binding-1"},
263263
Spec: placementv1beta1.ResourceBindingSpec{TargetCluster: "cluster-1"},
264264
},
265-
{
265+
&placementv1beta1.ClusterResourceBinding{
266266
ObjectMeta: metav1.ObjectMeta{Name: "binding-2"},
267267
Spec: placementv1beta1.ResourceBindingSpec{TargetCluster: "cluster-2"},
268268
},
@@ -280,8 +280,8 @@ func TestValidateDeleteStageStatus(t *testing.T) {
280280
name: "validateDeleteStageStatus should not return error if there's fewer to-be-deleted bindings",
281281
updatingStageIndex: -1,
282282
lastFinishedStageIndex: -1,
283-
toBeDeletedBindings: []*placementv1beta1.ClusterResourceBinding{
284-
{
283+
toBeDeletedBindings: []placementv1beta1.BindingObj{
284+
&placementv1beta1.ClusterResourceBinding{
285285
ObjectMeta: metav1.ObjectMeta{Name: "binding-1"},
286286
Spec: placementv1beta1.ResourceBindingSpec{TargetCluster: "cluster-1"},
287287
},
@@ -300,8 +300,8 @@ func TestValidateDeleteStageStatus(t *testing.T) {
300300
name: "validateDeleteStageStatus should not return error if there are equal to-be-deleted bindings",
301301
updatingStageIndex: -1,
302302
lastFinishedStageIndex: -1,
303-
toBeDeletedBindings: []*placementv1beta1.ClusterResourceBinding{
304-
{
303+
toBeDeletedBindings: []placementv1beta1.BindingObj{
304+
&placementv1beta1.ClusterResourceBinding{
305305
ObjectMeta: metav1.ObjectMeta{Name: "binding-1"},
306306
Spec: placementv1beta1.ResourceBindingSpec{TargetCluster: "cluster-1"},
307307
},

0 commit comments

Comments
 (0)