@@ -1876,9 +1876,7 @@ func Test_setStatusConditionAndServiceReplicaStatus(t *testing.T) {
18761876 tests := []struct {
18771877 name string
18781878 componentReconcileResult ComponentReconcileResult
1879- wantConditionStatus metav1.ConditionStatus
1880- wantConditionReason string
1881- wantConditionMessage string
1879+ wantConditions []metav1.Condition
18821880 wantServiceReplicaStatus * v1alpha1.ServiceReplicaStatus
18831881 wantObservedGeneration int64
18841882 }{
@@ -1898,9 +1896,20 @@ func Test_setStatusConditionAndServiceReplicaStatus(t *testing.T) {
18981896 AvailableReplicas : ptr .To (int32 (0 )),
18991897 },
19001898 },
1901- wantConditionStatus : metav1 .ConditionFalse ,
1902- wantConditionReason : "DeploymentNotReady" ,
1903- wantConditionMessage : "Deployment is not ready" ,
1899+ wantConditions : []metav1.Condition {
1900+ {
1901+ Type : v1alpha1 .DynamoGraphDeploymentConditionTypeAvailable ,
1902+ Status : metav1 .ConditionFalse ,
1903+ Reason : "DeploymentNotReady" ,
1904+ Message : "Deployment is not ready" ,
1905+ },
1906+ {
1907+ Type : v1alpha1 .DynamoGraphDeploymentConditionTypeDynamoComponentReady ,
1908+ Status : metav1 .ConditionFalse ,
1909+ Reason : "ComponentNotReady" ,
1910+ Message : "DynamoComponent is not ready" ,
1911+ },
1912+ },
19041913 wantServiceReplicaStatus : & v1alpha1.ServiceReplicaStatus {
19051914 ComponentKind : v1alpha1 .ComponentKindDeployment ,
19061915 ComponentName : "test-component" ,
@@ -1926,9 +1935,20 @@ func Test_setStatusConditionAndServiceReplicaStatus(t *testing.T) {
19261935 AvailableReplicas : ptr .To (int32 (2 )),
19271936 },
19281937 },
1929- wantConditionStatus : metav1 .ConditionTrue ,
1930- wantConditionReason : "DeploymentReady" ,
1931- wantConditionMessage : "Deployment is ready" ,
1938+ wantConditions : []metav1.Condition {
1939+ {
1940+ Type : v1alpha1 .DynamoGraphDeploymentConditionTypeAvailable ,
1941+ Status : metav1 .ConditionTrue ,
1942+ Reason : "DeploymentReady" ,
1943+ Message : "Deployment is ready" ,
1944+ },
1945+ {
1946+ Type : v1alpha1 .DynamoGraphDeploymentConditionTypeDynamoComponentReady ,
1947+ Status : metav1 .ConditionTrue ,
1948+ Reason : "ComponentReady" ,
1949+ Message : "DynamoComponent is ready" ,
1950+ },
1951+ },
19321952 wantServiceReplicaStatus : & v1alpha1.ServiceReplicaStatus {
19331953 ComponentKind : v1alpha1 .ComponentKindDeployment ,
19341954 ComponentName : "test-component" ,
@@ -1953,9 +1973,20 @@ func Test_setStatusConditionAndServiceReplicaStatus(t *testing.T) {
19531973 ReadyReplicas : ptr .To (int32 (2 )),
19541974 },
19551975 },
1956- wantConditionStatus : metav1 .ConditionFalse ,
1957- wantConditionReason : "SomeLeaderWorkerSetsNotReady" ,
1958- wantConditionMessage : "Some LeaderWorkerSets are not ready" ,
1976+ wantConditions : []metav1.Condition {
1977+ {
1978+ Type : v1alpha1 .DynamoGraphDeploymentConditionTypeAvailable ,
1979+ Status : metav1 .ConditionFalse ,
1980+ Reason : "SomeLeaderWorkerSetsNotReady" ,
1981+ Message : "Some LeaderWorkerSets are not ready" ,
1982+ },
1983+ {
1984+ Type : v1alpha1 .DynamoGraphDeploymentConditionTypeDynamoComponentReady ,
1985+ Status : metav1 .ConditionFalse ,
1986+ Reason : "ComponentNotReady" ,
1987+ Message : "DynamoComponent is not ready" ,
1988+ },
1989+ },
19591990 wantServiceReplicaStatus : & v1alpha1.ServiceReplicaStatus {
19601991 ComponentKind : v1alpha1 .ComponentKindLeaderWorkerSet ,
19611992 ComponentName : "test-component-0" ,
@@ -1979,9 +2010,20 @@ func Test_setStatusConditionAndServiceReplicaStatus(t *testing.T) {
19792010 ReadyReplicas : ptr .To (int32 (3 )),
19802011 },
19812012 },
1982- wantConditionStatus : metav1 .ConditionTrue ,
1983- wantConditionReason : "AllLeaderWorkerSetsReady" ,
1984- wantConditionMessage : "All LeaderWorkerSets are ready" ,
2013+ wantConditions : []metav1.Condition {
2014+ {
2015+ Type : v1alpha1 .DynamoGraphDeploymentConditionTypeAvailable ,
2016+ Status : metav1 .ConditionTrue ,
2017+ Reason : "AllLeaderWorkerSetsReady" ,
2018+ Message : "All LeaderWorkerSets are ready" ,
2019+ },
2020+ {
2021+ Type : v1alpha1 .DynamoGraphDeploymentConditionTypeDynamoComponentReady ,
2022+ Status : metav1 .ConditionTrue ,
2023+ Reason : "ComponentReady" ,
2024+ Message : "DynamoComponent is ready" ,
2025+ },
2026+ },
19852027 wantServiceReplicaStatus : & v1alpha1.ServiceReplicaStatus {
19862028 ComponentKind : v1alpha1 .ComponentKindLeaderWorkerSet ,
19872029 ComponentName : "test-component-0" ,
@@ -2049,14 +2091,17 @@ func Test_setStatusConditionAndServiceReplicaStatus(t *testing.T) {
20492091 err = fakeKubeClient .Get (ctx , req .NamespacedName , updatedDCD )
20502092 g .Expect (err ).NotTo (gomega .HaveOccurred ())
20512093
2052- // Assert the status condition
2053- g .Expect (updatedDCD .Status .Conditions ).To (gomega .HaveLen (1 ))
2054- condition := updatedDCD .Status .Conditions [0 ]
2055- g .Expect (condition .Type ).To (gomega .Equal (v1alpha1 .DynamoGraphDeploymentConditionTypeAvailable ))
2056- g .Expect (condition .Status ).To (gomega .Equal (tt .wantConditionStatus ))
2057- g .Expect (condition .Reason ).To (gomega .Equal (tt .wantConditionReason ))
2058- g .Expect (condition .Message ).To (gomega .Equal (tt .wantConditionMessage ))
2094+ // Assert the status conditions
2095+ g .Expect (updatedDCD .Status .Conditions ).To (gomega .HaveLen (len (tt .wantConditions )))
2096+
2097+ // Clear LastTransitionTime from actual conditions for comparison
2098+ actualConditions := make ([]metav1.Condition , len (updatedDCD .Status .Conditions ))
2099+ for i , cond := range updatedDCD .Status .Conditions {
2100+ cond .LastTransitionTime = metav1.Time {}
2101+ actualConditions [i ] = cond
2102+ }
20592103
2104+ g .Expect (actualConditions ).To (gomega .ConsistOf (tt .wantConditions ))
20602105 // Assert the service replica status
20612106 g .Expect (updatedDCD .Status .Service ).To (gomega .Equal (tt .wantServiceReplicaStatus ))
20622107
0 commit comments