6
6
7
7
import java .util .ArrayList ;
8
8
import java .util .Map ;
9
-
10
9
import oracle .kubernetes .operator .utils .Domain ;
11
10
import oracle .kubernetes .operator .utils .ExecCommand ;
12
11
import oracle .kubernetes .operator .utils .ExecResult ;
17
16
import org .junit .Assume ;
18
17
import org .junit .BeforeClass ;
19
18
import org .junit .FixMethodOrder ;
20
- import org .junit .Ignore ;
21
19
import org .junit .Test ;
22
20
import org .junit .runners .MethodSorters ;
23
21
@@ -133,17 +131,17 @@ public void testCreateSecondOperatorUsingSameOperatorNsNegativeInstall() throws
133
131
Operator firstoperator = null ;
134
132
Operator secondoperator = null ;
135
133
134
+ logger .info ("Creating first operator" );
135
+ firstoperator =
136
+ new Operator (TestUtils .createOperatorMap (number , true ), RestCertType .SELF_SIGNED );
137
+ firstoperator .callHelmInstall ();
138
+ number = number + 1 ;
139
+ oprelease = "op" + number ;
140
+ logger .info (" new value for oprelease" + oprelease );
141
+ Map <String , Object > operatorMap = TestUtils .createOperatorMap (number , true );
142
+ operatorMap .replace ("namespace" , firstoperator .getOperatorMap ().get ("namespace" ));
143
+ secondoperator = new Operator (operatorMap , false , true , true , RestCertType .SELF_SIGNED );
136
144
try {
137
- logger .info ("Creating firs toperator" );
138
- firstoperator =
139
- new Operator (TestUtils .createOperatorMap (number , true ), RestCertType .SELF_SIGNED );
140
- firstoperator .callHelmInstall ();
141
- number = number + 1 ;
142
- oprelease = "op" + number ;
143
- logger .info (" new value for oprelease" + oprelease );
144
- Map <String , Object > operatorMap = TestUtils .createOperatorMap (number , true );
145
- operatorMap .replace ("namespace" , firstoperator .getOperatorMap ().get ("namespace" ));
146
- secondoperator = new Operator (operatorMap , false , true , true , RestCertType .SELF_SIGNED );
147
145
secondoperator .callHelmInstall ();
148
146
throw new RuntimeException (
149
147
"FAILURE: Helm installs second operator with same namespace as the first one" );
@@ -184,32 +182,29 @@ public void testCreateSecondOperatorUsingSameOperatorNsNegativeInstall() throws
184
182
* @throws Exception exception
185
183
*/
186
184
@ Test
187
- @ Ignore
188
185
public void testNotPreCreatedOpNsCreateOperatorNegativeInstall () throws Exception {
189
186
Assume .assumeFalse (QUICKTEST );
190
187
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
191
188
logTestBegin (testMethodName );
192
189
Operator operator = null ;
190
+
191
+ operator =
192
+ new Operator (
193
+ (TestUtils .createOperatorMap (number , false )),
194
+ true ,
195
+ false ,
196
+ true ,
197
+ RestCertType .SELF_SIGNED );
198
+ String command = " kubectl delete namespace weblogic-operator" + number ;
199
+ TestUtils .exec (command );
193
200
try {
194
- operator =
195
- new Operator (
196
- (TestUtils .createOperatorMap (number , false )), false , false , true , RestCertType .NONE );
197
201
operator .callHelmInstall ();
198
202
throw new RuntimeException ("FAILURE: Helm install operator with not preexisted namespace " );
199
203
200
204
} catch (Exception ex ) {
201
- String cmdLb = "helm list --failed " + " | grep " + oprelease ;
202
- logger .info ("Executing cmd " + cmdLb );
203
- ExecResult result = ExecCommand .exec (cmdLb );
204
- if (result .exitValue () != 0 ) {
205
- throw new RuntimeException (
206
- "FAILURE: Helm installs operator with not preexisted namespace " );
207
- }
205
+ logger .info ("Helm install operator with not preexisted ns failed as expected" );
208
206
} finally {
209
207
number ++;
210
- if (operator != null ) {
211
- operator .destroy ();
212
- }
213
208
}
214
209
logger .info ("SUCCESS - " + testMethodName );
215
210
}
@@ -221,16 +216,20 @@ public void testNotPreCreatedOpNsCreateOperatorNegativeInstall() throws Exceptio
221
216
* @throws Exception exception
222
217
*/
223
218
@ Test
224
- @ Ignore
225
219
public void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall () throws Exception {
226
220
Assume .assumeFalse (QUICKTEST );
227
221
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
228
222
logTestBegin (testMethodName );
229
223
Operator operator = null ;
224
+
225
+ operator =
226
+ new Operator (
227
+ (TestUtils .createOperatorMap (number , false )),
228
+ true ,
229
+ false ,
230
+ true ,
231
+ RestCertType .SELF_SIGNED );
230
232
try {
231
- operator =
232
- new Operator (
233
- (TestUtils .createOperatorMap (number , false )), true , false , true , RestCertType .NONE );
234
233
operator .callHelmInstall ();
235
234
throw new RuntimeException (
236
235
"FAILURE: Helm installs operator with not preexisted service account " );
@@ -240,8 +239,7 @@ public void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() thr
240
239
logger .info ("Executing cmd " + cmdLb );
241
240
ExecResult result = ExecCommand .exec (cmdLb );
242
241
if (result .exitValue () != 0 ) {
243
- throw new RuntimeException (
244
- "FAILURE: Helm installs operator with not preexisted service account " );
242
+ throw new RuntimeException ("FAILURE: failed helm is not showed in the failed list " );
245
243
}
246
244
// create operator service account
247
245
String serviceAccount = (String ) operator .getOperatorMap ().get ("serviceAccount" );
@@ -279,25 +277,25 @@ public void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() thr
279
277
* @throws Exception exception
280
278
*/
281
279
@ Test
282
- @ Ignore
283
280
public void testSecondOpSharingSameTargetDomainsNsNegativeInstall () throws Exception {
284
281
Assume .assumeFalse (QUICKTEST );
285
282
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
286
283
logTestBegin (testMethodName );
287
284
Operator secondoperator = null ;
288
285
Operator firstoperator = null ;
286
+
287
+ logger .info ("Creating first operator" );
288
+ firstoperator =
289
+ new Operator (TestUtils .createOperatorMap (number , true ), RestCertType .SELF_SIGNED );
290
+ firstoperator .callHelmInstall ();
291
+ number = number + 1 ;
292
+ oprelease = "op" + number ;
293
+ Map <String , Object > operatorMap = TestUtils .createOperatorMap (number , false );
294
+ ArrayList <String > targetDomainsNS =
295
+ (ArrayList <String >) firstoperator .getOperatorMap ().get ("domainNamespaces" );
296
+ operatorMap .put ("domainNamespaces" , targetDomainsNS );
297
+ secondoperator = new Operator (operatorMap , true , true , false , RestCertType .SELF_SIGNED );
289
298
try {
290
- logger .info ("Creating first operator" );
291
- firstoperator =
292
- new Operator (TestUtils .createOperatorMap (number , true ), RestCertType .SELF_SIGNED );
293
- firstoperator .callHelmInstall ();
294
- number = number + 1 ;
295
- oprelease = "op" + number ;
296
- Map <String , Object > operatorMap = TestUtils .createOperatorMap (number , false );
297
- ArrayList <String > targetDomainsNS =
298
- (ArrayList <String >) firstoperator .getOperatorMap ().get ("domainNamespaces" );
299
- operatorMap .put ("domainNamespaces" , targetDomainsNS );
300
- secondoperator = new Operator (operatorMap , true , true , false , RestCertType .NONE );
301
299
secondoperator .callHelmInstall ();
302
300
throw new RuntimeException (
303
301
"FAILURE: Helm installs second operator with same as first operator's target domains namespaces " );
@@ -342,20 +340,23 @@ public void testSecondOpSharingSameTargetDomainsNsNegativeInstall() throws Excep
342
340
* @throws Exception exception
343
341
*/
344
342
@ Test
345
- @ Ignore
346
343
public void testTargetNsIsNotPreexistedNegativeInstall () throws Exception {
347
344
Assume .assumeFalse (QUICKTEST );
348
345
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
349
346
logTestBegin (testMethodName );
350
347
Operator operator = null ;
348
+
349
+ operator =
350
+ new Operator (
351
+ TestUtils .createOperatorMap (number , false ),
352
+ true ,
353
+ true ,
354
+ false ,
355
+ RestCertType .SELF_SIGNED );
351
356
try {
352
- operator =
353
- new Operator (
354
- TestUtils .createOperatorMap (number , false ), true , true , false , RestCertType .NONE );
355
357
operator .callHelmInstall ();
356
358
throw new RuntimeException (
357
359
"FAILURE: Helm install operator with not preexisted target domains namespaces " );
358
-
359
360
} catch (Exception ex ) {
360
361
if (!ex .getMessage ()
361
362
.contains (
@@ -401,18 +402,19 @@ public void testSecondOpSharingSameExternalRestPortNegativeInstall() throws Exce
401
402
Operator operator1 = null ;
402
403
Operator operator2 = null ;
403
404
int httpsRestPort = 0 ;
404
- try {
405
- operator1 = new Operator (TestUtils .createOperatorMap (number , true ), RestCertType .SELF_SIGNED );
406
- operator1 .callHelmInstall ();
407
405
408
- httpsRestPort = (int ) operator1 .getOperatorMap ().get ("externalRestHttpsPort" );
409
- logger .info ("Creating second operator with externalRestHttpPort " + httpsRestPort );
410
- number = number + 1 ;
411
- oprelease = "op" + number ;
412
- Map <String , Object > operatorMap = TestUtils .createOperatorMap (number , true );
413
- operatorMap .replace ("externalRestHttpsPort" , httpsRestPort );
406
+ operator1 = new Operator (TestUtils .createOperatorMap (number , true ), RestCertType .SELF_SIGNED );
407
+ operator1 .callHelmInstall ();
408
+
409
+ httpsRestPort = (int ) operator1 .getOperatorMap ().get ("externalRestHttpsPort" );
410
+ logger .info ("Creating second operator with externalRestHttpPort " + httpsRestPort );
411
+ number = number + 1 ;
412
+ oprelease = "op" + number ;
413
+ Map <String , Object > operatorMap = TestUtils .createOperatorMap (number , true );
414
+ operatorMap .replace ("externalRestHttpsPort" , httpsRestPort );
414
415
415
- operator2 = new Operator (operatorMap , RestCertType .SELF_SIGNED );
416
+ operator2 = new Operator (operatorMap , RestCertType .SELF_SIGNED );
417
+ try {
416
418
operator2 .callHelmInstall ();
417
419
418
420
throw new RuntimeException (
@@ -459,12 +461,13 @@ public void testCreateWithUpperCaseTargetDomainNegativeInstall() throws Exceptio
459
461
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
460
462
logTestBegin (testMethodName );
461
463
Operator operator = null ;
464
+
465
+ Map <String , Object > operatorMap = TestUtils .createOperatorMap (number , true );
466
+ ArrayList <String > targetDomainsNS = new ArrayList <String >();
467
+ targetDomainsNS .add ("Test9" );
468
+ operatorMap .replace ("domainNamespaces" , targetDomainsNS );
469
+ operator = new Operator (operatorMap , RestCertType .SELF_SIGNED );
462
470
try {
463
- Map <String , Object > operatorMap = TestUtils .createOperatorMap (number , true );
464
- ArrayList <String > targetDomainsNS = new ArrayList <String >();
465
- targetDomainsNS .add ("Test9" );
466
- operatorMap .replace ("domainNamespaces" , targetDomainsNS );
467
- operator = new Operator (operatorMap , RestCertType .SELF_SIGNED );
468
471
operator .callHelmInstall ();
469
472
throw new RuntimeException (
470
473
"FAILURE: Helm install operator with UpperCase for target domains " );
0 commit comments