@@ -125,19 +125,22 @@ public void test1CreateFirstOperatorAndDomain() throws Exception {
125
125
126
126
logTestBegin ("test1CreateFirstOperatorAndDomain" );
127
127
logger .info ("Creating Operator & waiting for the script to complete execution" );
128
- Domain domain1 = null ;
129
128
// create operator1
130
129
operator1 = TestUtils .createOperator (op1YamlFile );
130
+ Domain domain1 = null ;
131
+ boolean testCompletedSuccessfully = false ;
131
132
try {
132
133
domain1 = testDomainCreation (domain1YamlFile );
133
134
domain1 .verifyDomainCreated ();
134
135
testBasicUseCases (domain1 );
135
136
testAdvancedUseCasesForADomain (operator1 , domain1 );
136
137
137
138
if (!SMOKETEST ) domain1 .testWlsLivenessProbe ();
139
+ testCompletedSuccessfully = true ;
138
140
} finally {
139
141
140
- if (domain1 != null && JENKINS ) domain1 .shutdownUsingServerStartPolicy ();
142
+ if (domain1 != null && (JENKINS || testCompletedSuccessfully ))
143
+ domain1 .shutdownUsingServerStartPolicy ();
141
144
}
142
145
143
146
logger .info ("SUCCESS - test1CreateFirstOperatorAndDomain" );
@@ -150,7 +153,7 @@ public void test2CreateAnotherDomainInDefaultNS() throws Exception {
150
153
logTestBegin ("test2CreateAnotherDomainInDefaultNS" );
151
154
logger .info ("Creating Domain domain2 & verifing the domain creation" );
152
155
Domain domain2 = null ;
153
-
156
+ boolean testCompletedSuccessfully = false ;
154
157
if (operator1 == null ) {
155
158
operator1 = TestUtils .createOperator (op1YamlFile );
156
159
}
@@ -159,8 +162,9 @@ public void test2CreateAnotherDomainInDefaultNS() throws Exception {
159
162
domain2 = testDomainCreation (domain2YamlFile );
160
163
domain2 .verifyDomainCreated ();
161
164
testBasicUseCases (domain2 );
165
+ testCompletedSuccessfully = true ;
162
166
} finally {
163
- if (domain2 != null && JENKINS ) {
167
+ if (domain2 != null && ( JENKINS || testCompletedSuccessfully ) ) {
164
168
logger .info ("Destroy domain2" );
165
169
domain2 .destroy ();
166
170
}
@@ -178,14 +182,16 @@ public void test3CreateDomainInTest1NS() throws Exception {
178
182
operator1 = TestUtils .createOperator (op1YamlFile );
179
183
}
180
184
Domain domain3 = null ;
185
+ boolean testCompletedSuccessfully = false ;
181
186
try {
182
187
// create domain3
183
188
domain3 = testDomainCreation (domain3YamlFile );
184
189
domain3 .verifyDomainCreated ();
185
190
testBasicUseCases (domain3 );
186
191
testWLDFScaling (operator1 , domain3 );
192
+ testCompletedSuccessfully = true ;
187
193
} finally {
188
- if (domain3 != null && JENKINS ) {
194
+ if (domain3 != null && ( JENKINS || testCompletedSuccessfully ) ) {
189
195
domain3 .destroy ();
190
196
}
191
197
}
@@ -217,7 +223,7 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
217
223
}
218
224
219
225
Domain domain4 = null , domain5 = null ;
220
-
226
+ boolean testCompletedSuccessfully = false ;
221
227
try {
222
228
domain4 = testDomainCreation (domain4YamlFile );
223
229
domain4 .verifyDomainCreated ();
@@ -244,12 +250,13 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
244
250
245
251
logger .info ("Verify no impact on domain5" );
246
252
domain5 .verifyDomainCreated ();
253
+ testCompletedSuccessfully = true ;
247
254
logger .info ("SUCCESS - test5CreateConfiguredDomainInTest2NS" );
248
255
} finally {
249
- if (domain4 != null && JENKINS ) {
256
+ if (domain4 != null && ( JENKINS || testCompletedSuccessfully ) ) {
250
257
domain4 .destroy ();
251
258
}
252
- if (domain5 != null && JENKINS ) {
259
+ if (domain5 != null && ( JENKINS || testCompletedSuccessfully ) ) {
253
260
domain5 .destroy ();
254
261
}
255
262
}
@@ -267,12 +274,13 @@ public void test6CreateDomainWithStartPolicyAdminOnly() throws Exception {
267
274
logger .info ("Creating Domain domain6 & verifing the domain creation" );
268
275
// create domain6
269
276
Domain domain6 = null ;
270
-
277
+ boolean testCompletedSuccessfully = false ;
271
278
try {
272
279
domain6 = testDomainCreation (domain6YamlFile );
273
280
domain6 .verifyDomainCreated ();
281
+ testCompletedSuccessfully = true ;
274
282
} finally {
275
- if (domain6 != null && JENKINS ) domain6 .destroy ();
283
+ if (domain6 != null && ( JENKINS || testCompletedSuccessfully ) ) domain6 .destroy ();
276
284
}
277
285
278
286
logger .info ("SUCCESS - test6CreateDomainWithStartPolicyAdminOnly" );
@@ -290,6 +298,7 @@ public void test7CreateDomainPVReclaimPolicyRecycle() throws Exception {
290
298
logger .info ("Creating Domain domain7 & verifing the domain creation" );
291
299
// create domain7
292
300
Domain domain7 = null ;
301
+
293
302
try {
294
303
domain7 = testDomainCreation (domain7YamlFile );
295
304
domain7 .verifyDomainCreated ();
@@ -315,7 +324,7 @@ public void test8CreateDomainOnExistingDir() throws Exception {
315
324
domain8 = testDomainCreation (domain8YamlFile );
316
325
domain8 .verifyDomainCreated ();
317
326
} finally {
318
- if (domain8 != null && JENKINS ) {
327
+ if (domain8 != null ) {
319
328
// create domain on existing dir
320
329
domain8 .destroy ();
321
330
}
@@ -334,15 +343,16 @@ public void testACreateDomainApacheLB() throws Exception {
334
343
if (operator1 == null ) {
335
344
operator1 = TestUtils .createOperator (op1YamlFile );
336
345
}
337
-
346
+ boolean testCompletedSuccessfully = false ;
338
347
// create domain9
339
348
Domain domain9 = null ;
340
349
try {
341
350
domain9 = testDomainCreation (domain9YamlFile );
342
351
domain9 .verifyDomainCreated ();
343
352
domain9 .verifyAdminConsoleViaLB ();
353
+ testCompletedSuccessfully = true ;
344
354
} finally {
345
- if (domain9 != null && JENKINS ) domain9 .destroy ();
355
+ if (domain9 != null && ( JENKINS || testCompletedSuccessfully ) ) domain9 .destroy ();
346
356
}
347
357
logger .info ("SUCCESS - testACreateDomainApacheLB" );
348
358
}
@@ -359,13 +369,15 @@ public void testBCreateDomainWithDefaultValuesInSampleInputs() throws Exception
359
369
360
370
// create domain10
361
371
Domain domain10 = null ;
372
+ boolean testCompletedSuccessfully = false ;
362
373
try {
363
374
domain10 = testDomainCreation (domain10YamlFile );
364
375
domain10 .verifyDomainCreated ();
365
376
testBasicUseCases (domain10 );
366
377
testAdvancedUseCasesForADomain (operator1 , domain10 );
378
+ testCompletedSuccessfully = true ;
367
379
} finally {
368
- if (domain10 != null && JENKINS ) domain10 .destroy ();
380
+ if (domain10 != null && ( JENKINS || testCompletedSuccessfully ) ) domain10 .destroy ();
369
381
}
370
382
371
383
logger .info ("SUCCESS - testBCreateDomainWithDefaultValuesInSampleInputs" );
@@ -381,6 +393,7 @@ public void testDeleteOneDomain() throws Exception {
381
393
operatorForDel1 = TestUtils .createOperator (opForDelYamlFile1 );
382
394
}
383
395
Domain domain = null ;
396
+ boolean testCompletedSuccessfully = false ;
384
397
try {
385
398
domain = testDomainCreation (domain1ForDelValueYamlFile );
386
399
domain .verifyDomainCreated ();
@@ -390,8 +403,9 @@ public void testDeleteOneDomain() throws Exception {
390
403
TestUtils .deleteWeblogicDomainResources (domain .getDomainUid ());
391
404
392
405
TestUtils .verifyAfterDeletion (domain );
406
+ testCompletedSuccessfully = true ;
393
407
} finally {
394
- if (domain != null && JENKINS ) domain .destroy ();
408
+ if (domain != null && ( JENKINS || testCompletedSuccessfully ) ) domain .destroy ();
395
409
}
396
410
logger .info ("SUCCESS - testDeleteOneDomain" );
397
411
}
@@ -406,6 +420,7 @@ public void testDeleteTwoDomains() throws Exception {
406
420
operatorForDel2 = TestUtils .createOperator (opForDelYamlFile2 );
407
421
}
408
422
Domain domainDel1 = null , domainDel2 = null ;
423
+ boolean testCompletedSuccessfully = false ;
409
424
try {
410
425
domainDel1 = testDomainCreation (domain2ForDelValueYamlFile );
411
426
domainDel1 .verifyDomainCreated ();
@@ -422,9 +437,10 @@ public void testDeleteTwoDomains() throws Exception {
422
437
423
438
TestUtils .verifyAfterDeletion (domainDel1 );
424
439
TestUtils .verifyAfterDeletion (domainDel2 );
440
+ testCompletedSuccessfully = true ;
425
441
} finally {
426
- if (domainDel1 != null && JENKINS ) domainDel1 .destroy ();
427
- if (domainDel2 != null && JENKINS ) domainDel2 .destroy ();
442
+ if (domainDel1 != null && ( JENKINS || testCompletedSuccessfully ) ) domainDel1 .destroy ();
443
+ if (domainDel2 != null && ( JENKINS || testCompletedSuccessfully ) ) domainDel2 .destroy ();
428
444
}
429
445
logger .info ("SUCCESS - testDeleteTwoDomains" );
430
446
}
@@ -438,12 +454,14 @@ public void testAutoSitConfigOverrides() throws Exception {
438
454
operator1 = TestUtils .createOperator (op1YamlFile );
439
455
}
440
456
Domain domain11 = null ;
457
+ boolean testCompletedSuccessfully = false ;
441
458
try {
442
459
// cp py
443
460
copyCreateDomainScript ();
444
461
domain11 = testDomainCreation (domain11YamlFile );
445
462
domain11 .verifyDomainCreated ();
446
463
testBasicUseCases (domain11 );
464
+ testCompletedSuccessfully = true ;
447
465
logger .info ("SUCCESS - testAutoSitConfigOverrides" );
448
466
} finally {
449
467
@@ -457,7 +475,7 @@ public void testAutoSitConfigOverrides() throws Exception {
457
475
throw new RuntimeException (cmd + " failed" );
458
476
}
459
477
460
- if (domain11 != null && JENKINS ) {
478
+ if (domain11 != null && ( JENKINS || testCompletedSuccessfully ) ) {
461
479
domain11 .destroy ();
462
480
}
463
481
}
0 commit comments