From 91f0045820bc6af58a3b679b65ab970a37b852f3 Mon Sep 17 00:00:00 2001 From: Britania Rodriguez Reyes Date: Wed, 27 Nov 2024 16:39:43 -0600 Subject: [PATCH] minor changes for consistent UT --- .../workgenerator/controller_test.go | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/pkg/controllers/workgenerator/controller_test.go b/pkg/controllers/workgenerator/controller_test.go index ea83d6a0b..ff5377f6f 100644 --- a/pkg/controllers/workgenerator/controller_test.go +++ b/pkg/controllers/workgenerator/controller_test.go @@ -1272,6 +1272,18 @@ func TestSetBindingStatus(t *testing.T) { Status: metav1.ConditionTrue, }, }, + DriftDetails: &fleetv1beta1.DriftDetails{ + ObservationTime: metav1.NewTime(timeNow), + ObservedInMemberClusterGeneration: 2, + FirstDriftedObservedTime: metav1.NewTime(timeNow.Add(-time.Second)), + ObservedDrifts: []fleetv1beta1.PatchDetail{ + { + Path: "/metadata/labels/label1", + ValueInHub: "key1", + ValueInMember: "key2", + }, + }, + }, }, { Identifier: fleetv1beta1.WorkResourceIdentifier{ @@ -1287,17 +1299,9 @@ func TestSetBindingStatus(t *testing.T) { Type: fleetv1beta1.WorkConditionTypeApplied, Status: metav1.ConditionTrue, }, - }, - DriftDetails: &fleetv1beta1.DriftDetails{ - ObservationTime: metav1.NewTime(timeNow), - ObservedInMemberClusterGeneration: 2, - FirstDriftedObservedTime: metav1.NewTime(timeNow.Add(-time.Second)), - ObservedDrifts: []fleetv1beta1.PatchDetail{ - { - Path: "/spec/ports/1/port", - ValueInHub: "80", - ValueInMember: "90", - }, + { + Type: fleetv1beta1.WorkConditionTypeAvailable, + Status: metav1.ConditionTrue, }, }, }, @@ -1406,11 +1410,19 @@ func TestSetBindingStatus(t *testing.T) { Conditions: []metav1.Condition{ { Type: fleetv1beta1.WorkConditionTypeApplied, - Status: metav1.ConditionTrue, + Status: metav1.ConditionFalse, }, - { - Type: fleetv1beta1.WorkConditionTypeAvailable, - Status: metav1.ConditionTrue, + }, + DiffDetails: &fleetv1beta1.DiffDetails{ + ObservationTime: metav1.NewTime(timeNow), + ObservedInMemberClusterGeneration: 2, + FirstDiffedObservedTime: metav1.NewTime(timeNow.Add(-time.Second)), + ObservedDiffs: []fleetv1beta1.PatchDetail{ + { + Path: "/metadata/labels/label1", + ValueInHub: "key1", + ValueInMember: "key2", + }, }, }, }, @@ -1426,19 +1438,11 @@ func TestSetBindingStatus(t *testing.T) { Conditions: []metav1.Condition{ { Type: fleetv1beta1.WorkConditionTypeApplied, - Status: metav1.ConditionFalse, + Status: metav1.ConditionTrue, }, - }, - DiffDetails: &fleetv1beta1.DiffDetails{ - ObservationTime: metav1.NewTime(timeNow), - ObservedInMemberClusterGeneration: 2, - FirstDiffedObservedTime: metav1.NewTime(timeNow.Add(-time.Second)), - ObservedDiffs: []fleetv1beta1.PatchDetail{ - { - Path: "/spec/ports/0/port", - ValueInHub: "80", - ValueInMember: "90", - }, + { + Type: fleetv1beta1.WorkConditionTypeAvailable, + Status: metav1.ConditionTrue, }, }, },