44
55package oracle .kubernetes .operator ;
66
7+ import java .io .File ;
8+ import java .nio .file .Files ;
9+ import java .nio .file .StandardCopyOption ;
710import oracle .kubernetes .operator .utils .Domain ;
811import oracle .kubernetes .operator .utils .ExecCommand ;
912import oracle .kubernetes .operator .utils .ExecResult ;
@@ -46,6 +49,7 @@ public class ITOperator extends BaseTest {
4649 private static String domain9YamlFile = "domain9.yaml" ;
4750 private static String domain10YamlFile = "domain10.yaml" ;
4851 private static String domain11YamlFile = "domain11.yaml" ;
52+ private static String domain12YamlFile = "domain12.yaml" ;
4953
5054 // property file used to configure constants for integration tests
5155 private static String appPropsFile = "OperatorIT.properties" ;
@@ -250,7 +254,7 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
250254 logger .info ("Verify no impact on domain5" );
251255 domain5 .verifyDomainCreated ();
252256 testCompletedSuccessfully = true ;
253- logger . info ( "SUCCESS - test5CreateConfiguredDomainInTest2NS" );
257+
254258 } finally {
255259 if (domain4 != null && (JENKINS || testCompletedSuccessfully )) {
256260 domain4 .destroy ();
@@ -259,6 +263,7 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
259263 domain5 .destroy ();
260264 }
261265 }
266+ logger .info ("SUCCESS - test5CreateConfiguredDomainInTest2NS" );
262267 }
263268
264269 @ Test
@@ -458,7 +463,7 @@ public void testDeleteTwoDomains() throws Exception {
458463 logger .info ("SUCCESS - testDeleteTwoDomains" );
459464 }
460465
461- // @Test
466+ @ Test
462467 public void testAutoSitConfigOverrides () throws Exception {
463468 Assume .assumeFalse (QUICKTEST );
464469 logTestBegin ("testAutoSitConfigOverrides" );
@@ -468,32 +473,78 @@ public void testAutoSitConfigOverrides() throws Exception {
468473 }
469474 Domain domain11 = null ;
470475 boolean testCompletedSuccessfully = false ;
476+ String createDomainScriptDir =
477+ BaseTest .getProjectRoot () + "/integration-tests/src/test/resources/domain-home-on-pv" ;
471478 try {
479+
472480 // 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+
474490 domain11 = testDomainCreation (domain11YamlFile );
475491 domain11 .verifyDomainCreated ();
476492 testBasicUseCases (domain11 );
493+ // testAdvancedUseCasesForADomain(operator1, domain11);
477494 testCompletedSuccessfully = true ;
478495 logger .info ("SUCCESS - testAutoSitConfigOverrides" );
479496 } 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 );
491501 if (domain11 != null && (JENKINS || testCompletedSuccessfully )) {
492502 domain11 .destroy ();
493503 }
494504 }
495505 }
496506
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+
497548 private Domain testAdvancedUseCasesForADomain (Operator operator , Domain domain ) throws Exception {
498549 if (!SMOKETEST ) {
499550 testClusterScaling (operator , domain );
@@ -511,27 +562,4 @@ private void testBasicUseCases(Domain domain) throws Exception {
511562 testAdminT3Channel (domain );
512563 testAdminServerExternalService (domain );
513564 }
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- }
537565}
0 commit comments