@@ -123,127 +123,151 @@ func TestSupports(t *testing.T) {
123
123
},
124
124
operatorNamespace : "operators" ,
125
125
namespaces : []string {},
126
- expectedErr : nil ,
126
+ expectedErr : fmt . Errorf ( "operatorgroup has invalid selected namespaces, cannot configure to watch zero namespaces" ) ,
127
127
},
128
128
{
129
- description : "OneNamespace " ,
129
+ description : "OwnNamespace/OperatorNamespace/Supported " ,
130
130
installModeSet : InstallModeSet {
131
131
InstallModeTypeOwnNamespace : true ,
132
- InstallModeTypeSingleNamespace : true ,
133
- InstallModeTypeMultiNamespace : true ,
134
- InstallModeTypeAllNamespaces : true ,
132
+ InstallModeTypeSingleNamespace : false ,
133
+ InstallModeTypeMultiNamespace : false ,
134
+ InstallModeTypeAllNamespaces : false ,
135
135
},
136
136
operatorNamespace : "operators" ,
137
- namespaces : []string {"ns-0 " },
137
+ namespaces : []string {"operators " },
138
138
expectedErr : nil ,
139
139
},
140
140
{
141
- description : "MultipleNamespaces/MultiNamespaceUnsupported " ,
141
+ description : "SingleNamespace/OtherNamespace/Supported " ,
142
142
installModeSet : InstallModeSet {
143
- InstallModeTypeOwnNamespace : true ,
143
+ InstallModeTypeOwnNamespace : false ,
144
144
InstallModeTypeSingleNamespace : true ,
145
145
InstallModeTypeMultiNamespace : false ,
146
- InstallModeTypeAllNamespaces : true ,
146
+ InstallModeTypeAllNamespaces : false ,
147
147
},
148
148
operatorNamespace : "operators" ,
149
- namespaces : []string {"ns-0" , "ns-1" },
150
- expectedErr : fmt . Errorf ( "%s InstallModeType not supported, cannot configure to watch 2 namespaces" , InstallModeTypeMultiNamespace ) ,
149
+ namespaces : []string {"ns-0" },
150
+ expectedErr : nil ,
151
151
},
152
152
{
153
- description : "MultipleNamespaces/OwnNamespaceUnsupported " ,
153
+ description : "MultiNamespace/OtherNamespaces/Supported " ,
154
154
installModeSet : InstallModeSet {
155
155
InstallModeTypeOwnNamespace : false ,
156
- InstallModeTypeSingleNamespace : true ,
156
+ InstallModeTypeSingleNamespace : false ,
157
157
InstallModeTypeMultiNamespace : true ,
158
- InstallModeTypeAllNamespaces : true ,
158
+ InstallModeTypeAllNamespaces : false ,
159
159
},
160
160
operatorNamespace : "operators" ,
161
- namespaces : []string {"ns-0" , "ns-1" , "operators " },
162
- expectedErr : fmt . Errorf ( "%s InstallModeType not supported, cannot configure to watch own namespace" , InstallModeTypeOwnNamespace ) ,
161
+ namespaces : []string {"ns-0" , "ns-2 " },
162
+ expectedErr : nil ,
163
163
},
164
164
{
165
- description : "SingleNamespace/SingleAndMultiNamespaceUnsupported " ,
165
+ description : "AllNamespaces/NamespaceAll/Supported " ,
166
166
installModeSet : InstallModeSet {
167
- InstallModeTypeOwnNamespace : true ,
167
+ InstallModeTypeOwnNamespace : false ,
168
168
InstallModeTypeSingleNamespace : false ,
169
169
InstallModeTypeMultiNamespace : false ,
170
170
InstallModeTypeAllNamespaces : true ,
171
171
},
172
172
operatorNamespace : "operators" ,
173
- namespaces : []string {"ns-0 " },
174
- expectedErr : fmt . Errorf ( "%s InstallModeType not supported, cannot configure to watch one namespace" , InstallModeTypeSingleNamespace ) ,
173
+ namespaces : []string {"" },
174
+ expectedErr : nil ,
175
175
},
176
176
{
177
- description : "SingleNamespace/MultiNamespaceDecomposes " ,
177
+ description : "OwnNamespace/OperatorNamespace/Unsupported " ,
178
178
installModeSet : InstallModeSet {
179
- InstallModeTypeOwnNamespace : true ,
180
- InstallModeTypeSingleNamespace : false ,
179
+ InstallModeTypeOwnNamespace : false ,
180
+ InstallModeTypeSingleNamespace : true ,
181
181
InstallModeTypeMultiNamespace : true ,
182
182
InstallModeTypeAllNamespaces : true ,
183
183
},
184
184
operatorNamespace : "operators" ,
185
- namespaces : []string {"ns-0 " },
186
- expectedErr : nil ,
185
+ namespaces : []string {"operators " },
186
+ expectedErr : fmt . Errorf ( "%s InstallModeType not supported, cannot configure to watch own namespace" , InstallModeTypeOwnNamespace ) ,
187
187
},
188
188
{
189
- description : "SingleNamespace/OwnNamespaceUnsupported " ,
189
+ description : "OwnNamespace/IncludesOperatorNamespace/Unsupported " ,
190
190
installModeSet : InstallModeSet {
191
191
InstallModeTypeOwnNamespace : false ,
192
192
InstallModeTypeSingleNamespace : true ,
193
193
InstallModeTypeMultiNamespace : true ,
194
194
InstallModeTypeAllNamespaces : true ,
195
195
},
196
196
operatorNamespace : "operators" ,
197
- namespaces : []string {"operators" },
197
+ namespaces : []string {"ns-0" , " operators" },
198
198
expectedErr : fmt .Errorf ("%s InstallModeType not supported, cannot configure to watch own namespace" , InstallModeTypeOwnNamespace ),
199
199
},
200
200
{
201
- description : "AllNamespaces/AllNamespacesSupported " ,
201
+ description : "MultiNamespace/OtherNamespaces/Unsupported " ,
202
202
installModeSet : InstallModeSet {
203
203
InstallModeTypeOwnNamespace : true ,
204
204
InstallModeTypeSingleNamespace : true ,
205
+ InstallModeTypeMultiNamespace : false ,
206
+ InstallModeTypeAllNamespaces : true ,
207
+ },
208
+ operatorNamespace : "operators" ,
209
+ namespaces : []string {"ns-0" , "ns-1" },
210
+ expectedErr : fmt .Errorf ("%s InstallModeType not supported, cannot configure to watch 2 namespaces" , InstallModeTypeMultiNamespace ),
211
+ },
212
+ {
213
+ description : "SingleNamespace/OtherNamespace/Unsupported" ,
214
+ installModeSet : InstallModeSet {
215
+ InstallModeTypeOwnNamespace : true ,
216
+ InstallModeTypeSingleNamespace : false ,
205
217
InstallModeTypeMultiNamespace : true ,
206
218
InstallModeTypeAllNamespaces : true ,
207
219
},
208
220
operatorNamespace : "operators" ,
209
- namespaces : []string {corev1 . NamespaceAll },
210
- expectedErr : nil ,
221
+ namespaces : []string {"ns-0" },
222
+ expectedErr : fmt . Errorf ( "%s InstallModeType not supported, cannot configure to watch one namespace" , InstallModeTypeSingleNamespace ) ,
211
223
},
212
224
{
213
- description : "AllNamespaces/AllNamespacesUnsupported " ,
225
+ description : "AllNamespaces/NamespaceAll/Unsupported " ,
214
226
installModeSet : InstallModeSet {
215
227
InstallModeTypeOwnNamespace : true ,
216
228
InstallModeTypeSingleNamespace : true ,
217
229
InstallModeTypeMultiNamespace : true ,
218
230
InstallModeTypeAllNamespaces : false ,
219
231
},
220
232
operatorNamespace : "operators" ,
221
- namespaces : []string {corev1 . NamespaceAll },
233
+ namespaces : []string {"" },
222
234
expectedErr : fmt .Errorf ("%s InstallModeType not supported, cannot configure to watch all namespaces" , InstallModeTypeAllNamespaces ),
223
235
},
224
236
{
225
- description : "NoNamespaces/EmptyInstallModeSet" ,
237
+ description : "AllNamespaces/IncludingNamespaceAll/Unsupported" ,
238
+ installModeSet : InstallModeSet {
239
+ InstallModeTypeOwnNamespace : true ,
240
+ InstallModeTypeSingleNamespace : true ,
241
+ InstallModeTypeMultiNamespace : true ,
242
+ InstallModeTypeAllNamespaces : true ,
243
+ },
244
+ operatorNamespace : "operators" ,
245
+ namespaces : []string {"" , "ns-0" },
246
+ expectedErr : fmt .Errorf ("operatorgroup has invalid selected namespaces, NamespaceAll found when |selected namespaces| > 1" ),
247
+ },
248
+ {
249
+ description : "NoNamespaces/EmptyInstallModeSet/Unsupported" ,
226
250
installModeSet : InstallModeSet {},
227
251
operatorNamespace : "" ,
228
252
namespaces : []string {},
229
- expectedErr : nil ,
253
+ expectedErr : fmt . Errorf ( "operatorgroup has invalid selected namespaces, cannot configure to watch zero namespaces" ) ,
230
254
},
231
255
{
232
- description : "MultipleNamespaces/ EmptyInstallModeSet" ,
256
+ description : "MultiNamespace/OtherNamespaces/ EmptyInstallModeSet/Unsupported " ,
233
257
installModeSet : InstallModeSet {},
234
258
operatorNamespace : "operators" ,
235
259
namespaces : []string {"ns-0" , "ns-1" },
236
260
expectedErr : fmt .Errorf ("%s InstallModeType not supported, cannot configure to watch 2 namespaces" , InstallModeTypeMultiNamespace ),
237
261
},
238
262
{
239
- description : "SingleNamespace/EmptyInstallModeSet" ,
263
+ description : "SingleNamespace/OtherNamespace/ EmptyInstallModeSet/Unsupported " ,
240
264
installModeSet : InstallModeSet {},
241
265
operatorNamespace : "operators" ,
242
266
namespaces : []string {"ns-0" },
243
267
expectedErr : fmt .Errorf ("%s InstallModeType not supported, cannot configure to watch one namespace" , InstallModeTypeSingleNamespace ),
244
268
},
245
269
{
246
- description : "AllNamespaces/EmptyInstallModeSet" ,
270
+ description : "AllNamespaces/NamespaceAll/ EmptyInstallModeSet/Unsupported " ,
247
271
installModeSet : InstallModeSet {},
248
272
operatorNamespace : "operators" ,
249
273
namespaces : []string {corev1 .NamespaceAll },
0 commit comments