55
66import static org .junit .Assert .assertTrue ;
77
8- import java .io .IOException ;
98import java .nio .file .Files ;
109import java .nio .file .Paths ;
1110import java .nio .file .StandardCopyOption ;
@@ -34,7 +33,7 @@ public class ITMultipleClusters extends BaseTest {
3433 private static final String TWO_CONFIGURED_CLUSTER_SCRIPT =
3534 "create-domain-two-configured-cluster.py" ;
3635 private static final String TWO_MIXED_CLUSTER_SCRIPT = "create-domain-two-mixed-cluster.py" ;
37- private static String template ;
36+ private static String customDomainTemplate ;
3837 private static final String DOMAINUID = "twoconfigclustdomain" ;
3938
4039 /**
@@ -48,8 +47,16 @@ public class ITMultipleClusters extends BaseTest {
4847 public static void staticPrepare () throws Exception {
4948 // initialize test properties and create the directories
5049 initialize (APP_PROPS_FILE );
51- template =
50+ String template =
5251 BaseTest .getProjectRoot () + "/kubernetes/samples/scripts/common/domain-template.yaml" ;
52+ String add =
53+ " - clusterName: %CLUSTER_NAME%-2\n "
54+ + " serverStartState: \" RUNNING\" \n "
55+ + " replicas: %INITIAL_MANAGED_SERVER_REPLICAS%\n " ;
56+ customDomainTemplate = BaseTest .getResultDir () + "/customDomainTemplate.yaml" ;
57+ Files .copy (
58+ Paths .get (template ), Paths .get (customDomainTemplate ), StandardCopyOption .REPLACE_EXISTING );
59+ Files .write (Paths .get (customDomainTemplate ), add .getBytes (), StandardOpenOption .APPEND );
5360 }
5461
5562 /**
@@ -89,6 +96,7 @@ public void testCreateDomainTwoConfiguredCluster() throws Exception {
8996 Map <String , Object > domainMap = TestUtils .loadYaml (DOMAINONPV_WLST_YAML );
9097 domainMap .put ("domainUID" , DOMAINUID );
9198 domainMap .put ("clusterType" , "CONFIGURED" );
99+ domainMap .put ("customDomainTemplate" , customDomainTemplate );
92100 domainMap .put (
93101 "createDomainPyScript" ,
94102 "integration-tests/src/test/resources/domain-home-on-pv/"
@@ -98,7 +106,6 @@ public void testCreateDomainTwoConfiguredCluster() throws Exception {
98106 && ((String ) domainMap .get ("loadBalancer" )).equalsIgnoreCase ("VOYAGER" ))) {
99107 domainMap .put ("voyagerWebPort" , new Integer ("30366" ));
100108 }
101- addCluster2ToDomainTemplate (domainMap );
102109 domain = TestUtils .createDomain (domainMap );
103110 domain .verifyDomainCreated ();
104111 String pods [] = {
@@ -110,7 +117,6 @@ public void testCreateDomainTwoConfiguredCluster() throws Exception {
110117 DOMAINUID + "-new-managed-server2" ,
111118 };
112119 verifyServersStatus (domain , pods );
113-
114120 testBasicUseCases (domain );
115121 if (!SMOKETEST ) {
116122 domain .testWlsLivenessProbe ();
@@ -146,6 +152,7 @@ public void testCreateDomainTwoMixedCluster() throws Exception {
146152 try {
147153 Map <String , Object > domainMap = TestUtils .loadYaml (DOMAINONPV_WLST_YAML );
148154 domainMap .put ("domainUID" , DOMAINUID );
155+ domainMap .put ("customDomainTemplate" , customDomainTemplate );
149156 domainMap .put (
150157 "createDomainPyScript" ,
151158 "integration-tests/src/test/resources/domain-home-on-pv/" + TWO_MIXED_CLUSTER_SCRIPT );
@@ -154,7 +161,6 @@ public void testCreateDomainTwoMixedCluster() throws Exception {
154161 && ((String ) domainMap .get ("loadBalancer" )).equalsIgnoreCase ("VOYAGER" ))) {
155162 domainMap .put ("voyagerWebPort" , new Integer ("30377" ));
156163 }
157- addCluster2ToDomainTemplate (domainMap );
158164 domain = TestUtils .createDomain (domainMap );
159165 domain .verifyDomainCreated ();
160166 String pods [] = {
@@ -200,6 +206,7 @@ public void testCreateDomainTwoClusterWDTInImage() throws Exception {
200206 try {
201207 Map <String , Object > domainMap = TestUtils .loadYaml (DOMAININIMAGE_WDT_YAML );
202208 domainMap .put ("domainUID" , DOMAINUID );
209+ domainMap .put ("customDomainTemplate" , customDomainTemplate );
203210 if ((System .getenv ("LB_TYPE" ) != null && System .getenv ("LB_TYPE" ).equalsIgnoreCase ("VOYAGER" ))
204211 || (domainMap .containsKey ("loadBalancer" )
205212 && ((String ) domainMap .get ("loadBalancer" )).equalsIgnoreCase ("VOYAGER" ))) {
@@ -209,7 +216,6 @@ public void testCreateDomainTwoClusterWDTInImage() throws Exception {
209216 "customWdtTemplate" ,
210217 BaseTest .getProjectRoot ()
211218 + "/integration-tests/src/test/resources/multipleclusters/wdtmultipledynclusters.yml" );
212- addCluster2ToDomainTemplate (domainMap );
213219 domain = TestUtils .createDomain (domainMap );
214220 domain .verifyDomainCreated ();
215221 String pods [] = {
@@ -233,24 +239,6 @@ public void testCreateDomainTwoClusterWDTInImage() throws Exception {
233239 logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
234240 }
235241
236- /**
237- * Append a second cluster to the domain template
238- *
239- * @throws IOException when append fails
240- */
241- private void addCluster2ToDomainTemplate (Map <String , Object > domainMap ) throws IOException {
242- String add =
243- " - clusterName: %CLUSTER_NAME%-2\n "
244- + " serverStartState: \" RUNNING\" \n "
245- + " replicas: %INITIAL_MANAGED_SERVER_REPLICAS%\n " ;
246- String customDomainTemplate =
247- System .getProperty ("java.io.tmpdir" ) + "/customDomainTemplate.yaml" ;
248- Files .copy (
249- Paths .get (template ), Paths .get (customDomainTemplate ), StandardCopyOption .REPLACE_EXISTING );
250- Files .write (Paths .get (customDomainTemplate ), add .getBytes (), StandardOpenOption .APPEND );
251- domainMap .put ("customDomainTemplate" , customDomainTemplate );
252- }
253-
254242 /**
255243 * Verifies all of the servers in the cluster are in Running status
256244 *
0 commit comments