@@ -89,13 +89,6 @@ func Test_Status_SaveInitialStart(t *testing.T) {
89
89
func Test_updatingConditionsInDisabledState (t * testing.T ) {
90
90
lastTransitionTime := metav1 .Date (2022 , 3 , 21 , 16 , 20 , 30 , 0 , time .UTC )
91
91
92
- availableCondition := configv1.ClusterOperatorStatusCondition {
93
- Type : configv1 .OperatorAvailable ,
94
- Status : configv1 .ConditionTrue ,
95
- Reason : asExpectedReason ,
96
- Message : insightsAvailableMessage ,
97
- LastTransitionTime : lastTransitionTime ,
98
- }
99
92
progressingCondition := configv1.ClusterOperatorStatusCondition {
100
93
Type : configv1 .OperatorProgressing ,
101
94
Status : configv1 .ConditionFalse ,
@@ -121,7 +114,13 @@ func Test_updatingConditionsInDisabledState(t *testing.T) {
121
114
testCO := configv1.ClusterOperator {
122
115
Status : configv1.ClusterOperatorStatus {
123
116
Conditions : []configv1.ClusterOperatorStatusCondition {
124
- availableCondition ,
117
+ {
118
+ Type : configv1 .OperatorAvailable ,
119
+ Status : configv1 .ConditionTrue ,
120
+ Reason : asExpectedReason ,
121
+ Message : insightsAvailableMessage ,
122
+ LastTransitionTime : lastTransitionTime ,
123
+ },
125
124
progressingCondition ,
126
125
degradedCondition ,
127
126
upgradeableCondition ,
@@ -141,8 +140,7 @@ func Test_updatingConditionsInDisabledState(t *testing.T) {
141
140
apiConfigurator : config .NewMockAPIConfigurator (nil ),
142
141
}
143
142
updatedCO := testController .merge (& testCO )
144
- // check that all the conditions are not touched except the disabled one
145
- assert .Equal (t , availableCondition , * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorAvailable ))
143
+ // check that all the conditions are not touched except the disabled and available conditions
146
144
assert .Equal (t , progressingCondition , * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorProgressing ))
147
145
assert .Equal (t , degradedCondition , * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorDegraded ))
148
146
assert .Equal (t , upgradeableCondition , * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorUpgradeable ))
@@ -153,10 +151,16 @@ func Test_updatingConditionsInDisabledState(t *testing.T) {
153
151
assert .Equal (t , reportingDisabledMsg , disabledCondition .Message )
154
152
assert .True (t , disabledCondition .LastTransitionTime .After (lastTransitionTime .Time ))
155
153
154
+ availableCondition := getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorAvailable )
155
+ assert .Equal (t , configv1 .ConditionFalse , availableCondition .Status )
156
+ assert .Equal (t , noTokenReason , availableCondition .Reason )
157
+ assert .Equal (t , reportingDisabledMsg , availableCondition .Message )
158
+ assert .True (t , availableCondition .LastTransitionTime .After (lastTransitionTime .Time ))
159
+
156
160
// upgrade status again and nothing should change
157
161
updatedCO = testController .merge (updatedCO )
158
162
// check that all the conditions are not touched including the disabled one
159
- assert .Equal (t , availableCondition , * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorAvailable ))
163
+ assert .Equal (t , availableCondition , getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorAvailable ))
160
164
assert .Equal (t , progressingCondition , * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorProgressing ))
161
165
assert .Equal (t , degradedCondition , * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorDegraded ))
162
166
assert .Equal (t , upgradeableCondition , * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorUpgradeable ))
@@ -212,15 +216,17 @@ func Test_updatingConditionsFromDegradedToDisabled(t *testing.T) {
212
216
updatedCO := testController .merge (& testCO )
213
217
// check that all conditions changed except the Progressing since it's still False
214
218
availableCondition := * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorAvailable )
215
- assert .Equal (t , availableCondition .Status , configv1 .ConditionTrue )
216
- assert .True (t , availableCondition .LastTransitionTime .After (lastTransitionTime .Time ))
219
+ assert .Equal (t , configv1 .ConditionFalse , availableCondition .Status )
220
+ assert .Equal (t , noTokenReason , availableCondition .Reason )
221
+ assert .Equal (t , reportingDisabledMsg , availableCondition .Message )
222
+ assert .Equal (t , lastTransitionTime , availableCondition .LastTransitionTime )
217
223
218
224
degradedCondition := * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorDegraded )
219
- assert .Equal (t , degradedCondition . Status , configv1 . ConditionFalse )
225
+ assert .Equal (t , configv1 . ConditionFalse , degradedCondition . Status )
220
226
assert .True (t , degradedCondition .LastTransitionTime .After (lastTransitionTime .Time ))
221
227
222
228
upgradeableCondition := * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorUpgradeable )
223
- assert .Equal (t , upgradeableCondition . Status , configv1 . ConditionTrue )
229
+ assert .Equal (t , configv1 . ConditionTrue , upgradeableCondition . Status )
224
230
assert .True (t , upgradeableCondition .LastTransitionTime .After (lastTransitionTime .Time ))
225
231
226
232
assert .Equal (t , progressingCondition , * getConditionByType (updatedCO .Status .Conditions , configv1 .OperatorProgressing ))
0 commit comments