@@ -63,11 +63,165 @@ func TestGetNewStatus(t *testing.T) {
63
63
Message : "Safe to upgrade" ,
64
64
LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
65
65
},
66
+ {
67
+ Type : configv1 .OperatorProgressing ,
68
+ Status : configv1 .ConditionTrue ,
69
+ Message : "Working toward 1.0.0" ,
70
+ LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
71
+ },
72
+ },
73
+ Versions : []configv1.OperandVersion {},
74
+ RelatedObjects : []configv1.ObjectReference {
75
+ {
76
+ Group : "" ,
77
+ Resource : "namespaces" ,
78
+ Namespace : "" ,
79
+ Name : "foo-namespace" ,
80
+ },
81
+ {
82
+ Group : v1alpha1 .GroupName ,
83
+ Resource : clusterServiceVersionResource ,
84
+ Namespace : "foo-namespace" ,
85
+ Name : "foo" ,
86
+ },
87
+ },
88
+ },
89
+ },
90
+
91
+ {
92
+ name : "WithCSVInProgressAlreadyAvailableTrue" ,
93
+ context : & csvEventContext {
94
+ Name : "foo" ,
95
+ CurrentDeleted : false ,
96
+ Current : & v1alpha1.ClusterServiceVersion {
97
+ ObjectMeta : metav1.ObjectMeta {
98
+ Name : "foo" ,
99
+ Namespace : "foo-namespace" ,
100
+ },
101
+ Spec : v1alpha1.ClusterServiceVersionSpec {
102
+ Version : version.OperatorVersion {
103
+ semver.Version {
104
+ Major : 1 , Minor : 0 , Patch : 0 ,
105
+ },
106
+ },
107
+ },
108
+ Status : v1alpha1.ClusterServiceVersionStatus {
109
+ Phase : v1alpha1 .CSVPhasePending ,
110
+ Reason : v1alpha1 .CSVReasonWaiting ,
111
+ Message : "Progressing towards 1.0.0" ,
112
+ },
113
+ },
114
+ },
115
+ existing : & configv1.ClusterOperatorStatus {
116
+ Conditions : []configv1.ClusterOperatorStatusCondition {
117
+ {
118
+ Type : configv1 .OperatorAvailable ,
119
+ Status : configv1 .ConditionTrue ,
120
+ Message : "test message" ,
121
+ Reason : "test reason" ,
122
+ LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
123
+ },
124
+ },
125
+ },
126
+
127
+ expected : & configv1.ClusterOperatorStatus {
128
+ Conditions : []configv1.ClusterOperatorStatusCondition {
66
129
{
67
130
Type : configv1 .OperatorAvailable ,
131
+ Status : configv1 .ConditionTrue ,
132
+ Message : "test message" ,
133
+ Reason : "test reason" ,
134
+ LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
135
+ },
136
+ {
137
+ Type : configv1 .OperatorDegraded ,
68
138
Status : configv1 .ConditionFalse ,
69
- Message : "ClusterServiceVersion foo-namespace/foo is in phase Pending with reason: InstallWaiting, message: Progressing towards 1.0.0" ,
70
- Reason : "ClusterServiceVersionNotSucceeded" ,
139
+ LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
140
+ },
141
+ {
142
+ Type : configv1 .OperatorUpgradeable ,
143
+ Status : configv1 .ConditionTrue ,
144
+ Message : "Safe to upgrade" ,
145
+ LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
146
+ },
147
+ {
148
+ Type : configv1 .OperatorProgressing ,
149
+ Status : configv1 .ConditionTrue ,
150
+ Message : "Working toward 1.0.0" ,
151
+ LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
152
+ },
153
+ },
154
+ RelatedObjects : []configv1.ObjectReference {
155
+ {
156
+ Group : "" ,
157
+ Resource : "namespaces" ,
158
+ Namespace : "" ,
159
+ Name : "foo-namespace" ,
160
+ },
161
+ {
162
+ Group : v1alpha1 .GroupName ,
163
+ Resource : clusterServiceVersionResource ,
164
+ Namespace : "foo-namespace" ,
165
+ Name : "foo" ,
166
+ },
167
+ },
168
+ },
169
+ },
170
+
171
+ {
172
+ name : "WithCSVInProgressAlreadyAvailableFalse" ,
173
+ context : & csvEventContext {
174
+ Name : "foo" ,
175
+ CurrentDeleted : false ,
176
+ Current : & v1alpha1.ClusterServiceVersion {
177
+ ObjectMeta : metav1.ObjectMeta {
178
+ Name : "foo" ,
179
+ Namespace : "foo-namespace" ,
180
+ },
181
+ Spec : v1alpha1.ClusterServiceVersionSpec {
182
+ Version : version.OperatorVersion {
183
+ semver.Version {
184
+ Major : 1 , Minor : 0 , Patch : 0 ,
185
+ },
186
+ },
187
+ },
188
+ Status : v1alpha1.ClusterServiceVersionStatus {
189
+ Phase : v1alpha1 .CSVPhasePending ,
190
+ Reason : v1alpha1 .CSVReasonWaiting ,
191
+ Message : "Progressing towards 1.0.0" ,
192
+ },
193
+ },
194
+ },
195
+ existing : & configv1.ClusterOperatorStatus {
196
+ Conditions : []configv1.ClusterOperatorStatusCondition {
197
+ {
198
+ Type : configv1 .OperatorAvailable ,
199
+ Status : configv1 .ConditionFalse ,
200
+ Message : "test message" ,
201
+ Reason : "test reason" ,
202
+ LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
203
+ },
204
+ },
205
+ },
206
+
207
+ expected : & configv1.ClusterOperatorStatus {
208
+ Conditions : []configv1.ClusterOperatorStatusCondition {
209
+ {
210
+ Type : configv1 .OperatorAvailable ,
211
+ Status : configv1 .ConditionFalse ,
212
+ Message : "test message" ,
213
+ Reason : "test reason" ,
214
+ LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
215
+ },
216
+ {
217
+ Type : configv1 .OperatorDegraded ,
218
+ Status : configv1 .ConditionFalse ,
219
+ LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
220
+ },
221
+ {
222
+ Type : configv1 .OperatorUpgradeable ,
223
+ Status : configv1 .ConditionTrue ,
224
+ Message : "Safe to upgrade" ,
71
225
LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
72
226
},
73
227
{
@@ -77,7 +231,6 @@ func TestGetNewStatus(t *testing.T) {
77
231
LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
78
232
},
79
233
},
80
- Versions : []configv1.OperandVersion {},
81
234
RelatedObjects : []configv1.ObjectReference {
82
235
{
83
236
Group : "" ,
@@ -95,7 +248,6 @@ func TestGetNewStatus(t *testing.T) {
95
248
},
96
249
},
97
250
98
- // A CSV has successfully installed.
99
251
{
100
252
name : "WithCSVSuccessfullyInstalled" ,
101
253
context : & csvEventContext {
@@ -135,7 +287,7 @@ func TestGetNewStatus(t *testing.T) {
135
287
{
136
288
Type : configv1 .OperatorAvailable ,
137
289
Status : configv1 .ConditionTrue ,
138
- Message : "ClusterServiceVersion foo-namespace/foo is in phase Succeeded" ,
290
+ Message : "ClusterServiceVersion foo-namespace/foo observed in phase Succeeded" ,
139
291
Reason : "ClusterServiceVersionSucceeded" ,
140
292
LastTransitionTime : metav1 .NewTime (fakeClock .Now ()),
141
293
},
0 commit comments