4
4
5
5
package oracle .kubernetes .operator ;
6
6
7
+ import java .io .File ;
8
+ import java .nio .file .Files ;
9
+ import java .nio .file .StandardCopyOption ;
7
10
import oracle .kubernetes .operator .utils .Domain ;
8
11
import oracle .kubernetes .operator .utils .ExecCommand ;
9
12
import oracle .kubernetes .operator .utils .ExecResult ;
@@ -46,6 +49,7 @@ public class ITOperator extends BaseTest {
46
49
private static String domain9YamlFile = "domain9.yaml" ;
47
50
private static String domain10YamlFile = "domain10.yaml" ;
48
51
private static String domain11YamlFile = "domain11.yaml" ;
52
+ private static String domain12YamlFile = "domain12.yaml" ;
49
53
50
54
// property file used to configure constants for integration tests
51
55
private static String appPropsFile = "OperatorIT.properties" ;
@@ -250,7 +254,7 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
250
254
logger .info ("Verify no impact on domain5" );
251
255
domain5 .verifyDomainCreated ();
252
256
testCompletedSuccessfully = true ;
253
- logger . info ( "SUCCESS - test5CreateConfiguredDomainInTest2NS" );
257
+
254
258
} finally {
255
259
if (domain4 != null && (JENKINS || testCompletedSuccessfully )) {
256
260
domain4 .destroy ();
@@ -259,6 +263,7 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
259
263
domain5 .destroy ();
260
264
}
261
265
}
266
+ logger .info ("SUCCESS - test5CreateConfiguredDomainInTest2NS" );
262
267
}
263
268
264
269
@ Test
@@ -458,7 +463,7 @@ public void testDeleteTwoDomains() throws Exception {
458
463
logger .info ("SUCCESS - testDeleteTwoDomains" );
459
464
}
460
465
461
- // @Test
466
+ @ Test
462
467
public void testAutoSitConfigOverrides () throws Exception {
463
468
Assume .assumeFalse (QUICKTEST );
464
469
logTestBegin ("testAutoSitConfigOverrides" );
@@ -468,32 +473,78 @@ public void testAutoSitConfigOverrides() throws Exception {
468
473
}
469
474
Domain domain11 = null ;
470
475
boolean testCompletedSuccessfully = false ;
476
+ String createDomainScriptDir =
477
+ BaseTest .getProjectRoot () + "/integration-tests/src/test/resources/domain-home-on-pv" ;
471
478
try {
479
+
472
480
// cp py
473
- copyCreateDomainScript ();
481
+ Files .copy (
482
+ new File (createDomainScriptDir + "/create-domain.py" ).toPath (),
483
+ new File (createDomainScriptDir + "/create-domain.py.bak" ).toPath (),
484
+ StandardCopyOption .REPLACE_EXISTING );
485
+ Files .copy (
486
+ new File (createDomainScriptDir + "/create-domain-auto-sit-config.py" ).toPath (),
487
+ new File (createDomainScriptDir + "/create-domain.py" ).toPath (),
488
+ StandardCopyOption .REPLACE_EXISTING );
489
+
474
490
domain11 = testDomainCreation (domain11YamlFile );
475
491
domain11 .verifyDomainCreated ();
476
492
testBasicUseCases (domain11 );
493
+ // testAdvancedUseCasesForADomain(operator1, domain11);
477
494
testCompletedSuccessfully = true ;
478
495
logger .info ("SUCCESS - testAutoSitConfigOverrides" );
479
496
} finally {
480
-
481
- StringBuffer cmd = new StringBuffer ("cd " );
482
- cmd .append (BaseTest .getProjectRoot ())
483
- .append (
484
- "/integration-tests/src/test/resources/domain-home-on-pv && cp create-domain.py.bak create-domain.py" );
485
- logger .info ("Running " + cmd );
486
- ExecResult result = ExecCommand .exec (cmd .toString ());
487
- if (result .exitValue () != 0 ) {
488
- throw new RuntimeException (cmd + " failed" );
489
- }
490
-
497
+ Files .copy (
498
+ new File (createDomainScriptDir + "/create-domain.py.bak" ).toPath (),
499
+ new File (createDomainScriptDir + "/create-domain.py" ).toPath (),
500
+ StandardCopyOption .REPLACE_EXISTING );
491
501
if (domain11 != null && (JENKINS || testCompletedSuccessfully )) {
492
502
domain11 .destroy ();
493
503
}
494
504
}
495
505
}
496
506
507
+ // @Test
508
+ public void testCustomSitConfigOverrides () throws Exception {
509
+ Assume .assumeFalse (QUICKTEST );
510
+ logTestBegin ("testCustomSitConfigOverrides" );
511
+
512
+ if (operator1 == null ) {
513
+ operator1 = TestUtils .createOperator (op1YamlFile );
514
+ }
515
+ Domain domain12 = null ;
516
+ boolean testCompletedSuccessfully = false ;
517
+ String createDomainScriptDir =
518
+ BaseTest .getProjectRoot () + "/integration-tests/src/test/resources/domain-home-on-pv" ;
519
+ try {
520
+
521
+ // cp py
522
+ Files .copy (
523
+ new File (createDomainScriptDir + "/create-domain.py" ).toPath (),
524
+ new File (createDomainScriptDir + "/create-domain.py.bak" ).toPath (),
525
+ StandardCopyOption .REPLACE_EXISTING );
526
+ Files .copy (
527
+ new File (createDomainScriptDir + "/create-domain-custom-sit-config.py" ).toPath (),
528
+ new File (createDomainScriptDir + "/create-domain.py" ).toPath (),
529
+ StandardCopyOption .REPLACE_EXISTING );
530
+
531
+ domain12 = testDomainCreation (domain12YamlFile );
532
+ domain12 .verifyDomainCreated ();
533
+ testBasicUseCases (domain12 );
534
+ // testAdvancedUseCasesForADomain(operator1, domain11);
535
+ testCompletedSuccessfully = true ;
536
+ logger .info ("SUCCESS - testCustomSitConfigOverrides" );
537
+ } finally {
538
+ Files .copy (
539
+ new File (createDomainScriptDir + "/create-domain.py.bak" ).toPath (),
540
+ new File (createDomainScriptDir + "/create-domain.py" ).toPath (),
541
+ StandardCopyOption .REPLACE_EXISTING );
542
+ if (domain12 != null && (JENKINS || testCompletedSuccessfully )) {
543
+ domain12 .destroy ();
544
+ }
545
+ }
546
+ }
547
+
497
548
private Domain testAdvancedUseCasesForADomain (Operator operator , Domain domain ) throws Exception {
498
549
if (!SMOKETEST ) {
499
550
testClusterScaling (operator , domain );
@@ -511,27 +562,4 @@ private void testBasicUseCases(Domain domain) throws Exception {
511
562
testAdminT3Channel (domain );
512
563
testAdminServerExternalService (domain );
513
564
}
514
-
515
- private void copyCreateDomainScript () throws Exception {
516
- String createDomainScriptPath =
517
- BaseTest .getProjectRoot () + "/integration-tests/src/test/resources/domain-home-on-pv" ;
518
-
519
- StringBuffer cmd = new StringBuffer ("cd " );
520
- cmd .append (createDomainScriptPath ).append (" && cp create-domain.py create-domain.py.bak" );
521
- logger .info ("Running " + cmd );
522
-
523
- ExecResult result = ExecCommand .exec (cmd .toString ());
524
- if (result .exitValue () != 0 ) {
525
- throw new RuntimeException (cmd + " failed" );
526
- }
527
-
528
- cmd = new StringBuffer ("cd " );
529
- cmd .append (createDomainScriptPath )
530
- .append (" && cp create-domain-auto-sit-config.py create-domain.py" );
531
- logger .info ("Running " + cmd );
532
- result = ExecCommand .exec (cmd .toString ());
533
- if (result .exitValue () != 0 ) {
534
- throw new RuntimeException (cmd + " failed" );
535
- }
536
- }
537
565
}
0 commit comments