Skip to content

Commit 45964b7

Browse files
committed
refine the code with TestUtils.domainMapUpdateWithLbInfor
1 parent ed9192f commit 45964b7

File tree

2 files changed

+20
-61
lines changed

2 files changed

+20
-61
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/ITOperator.java

Lines changed: 8 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,9 @@ public void testDomainOnPVUsingWLST() throws Exception {
154154
Domain domain = null;
155155
boolean testCompletedSuccessfully = false;
156156
try {
157-
// domain = TestUtils.createDomain(domainonpvwlstFile);TODO
158157
if (VOYAGER) {
159158
Map<String, Object> wlstDomainMap = TestUtils.loadYaml(domainonpvwlstFile);
160-
wlstDomainMap.put("loadBalancer", "VOYAGER");
161-
wlstDomainMap.put("loadBalancerWebPort", new Integer("30305"));
162-
logger.info(
163-
"domainonpvwlst loadBalancer is set to: "
164-
+ wlstDomainMap.get("loadBalancer")
165-
+ " with loadBalancerWebPort:"
166-
+ wlstDomainMap.get("loadBalancerWebPort"));
159+
TestUtils.domainMapUpdateWithLbInfor(wlstDomainMap, "VOYAGER", new Integer("30305"));
167160
domain = TestUtils.createDomain(wlstDomainMap);
168161
} else {
169162
domain = TestUtils.createDomain(domainonpvwlstFile);
@@ -207,16 +200,9 @@ public void testDomainOnPVUsingWDT() throws Exception {
207200
boolean testCompletedSuccessfully = false;
208201
try {
209202
// create domain
210-
// domain = TestUtils.createDomain(domainonpvwdtFile); TODO
211203
if (VOYAGER) {
212204
Map<String, Object> wdtDomainMap = TestUtils.loadYaml(domainonpvwdtFile);
213-
wdtDomainMap.put("loadBalancer", "VOYAGER");
214-
wdtDomainMap.put("loadBalancerWebPort", new Integer("30306"));
215-
logger.info(
216-
"domainonpvwdt loadBalancer is set to: "
217-
+ wdtDomainMap.get("loadBalancer")
218-
+ " with loadBalancerWebPort:"
219-
+ wdtDomainMap.get("loadBalancerWebPort"));
205+
TestUtils.domainMapUpdateWithLbInfor(wdtDomainMap, "VOYAGER", new Integer("30306"));
220206
domain = TestUtils.createDomain(wdtDomainMap);
221207
} else {
222208
domain = TestUtils.createDomain(domainonpvwdtFile);
@@ -271,13 +257,7 @@ public void testTwoDomainsManagedByTwoOperators() throws Exception {
271257
wlstDomainMap.put("adminNodePort", new Integer("30702"));
272258
wlstDomainMap.put("t3ChannelPort", new Integer("30031"));
273259
if (VOYAGER) {
274-
wlstDomainMap.put("loadBalancer", "VOYAGER");
275-
wlstDomainMap.put("loadBalancerWebPort", new Integer("30307"));
276-
logger.info(
277-
"domain1onpvwlst loadBalancer is set to: "
278-
+ wlstDomainMap.get("loadBalancer")
279-
+ " with loadBalancerWebPort:"
280-
+ wlstDomainMap.get("loadBalancerWebPort"));
260+
TestUtils.domainMapUpdateWithLbInfor(wlstDomainMap, "VOYAGER", new Integer("30307"));
281261
}
282262
if (!INGRESSPERDOMAIN) {
283263
wlstDomainMap.put("ingressPerDomain", new Boolean("false"));
@@ -301,13 +281,7 @@ public void testTwoDomainsManagedByTwoOperators() throws Exception {
301281
wdtDomainMap.put("t3ChannelPort", new Integer("30041"));
302282
// wdtDomainMap.put("clusterType", "Configured");
303283
if (VOYAGER) {
304-
wdtDomainMap.put("loadBalancer", "VOYAGER");
305-
wdtDomainMap.put("loadBalancerWebPort", new Integer("30308"));
306-
logger.info(
307-
"domain2onpvwdt loadBalancer is set to: "
308-
+ wdtDomainMap.get("loadBalancer")
309-
+ " with loadBalancerWebPort:"
310-
+ wdtDomainMap.get("loadBalancerWebPort"));
284+
TestUtils.domainMapUpdateWithLbInfor(wdtDomainMap, "VOYAGER", new Integer("30308"));
311285
}
312286
if (!INGRESSPERDOMAIN) {
313287
wdtDomainMap.put("ingressPerDomain", new Boolean("false"));
@@ -373,16 +347,9 @@ public void testCreateDomainWithStartPolicyAdminOnly() throws Exception {
373347
Domain domain = null;
374348
boolean testCompletedSuccessfully = false;
375349
try {
376-
// domain = TestUtils.createDomain(domainadminonlyFile);TODO
377350
if (VOYAGER) {
378351
Map<String, Object> domainMap = TestUtils.loadYaml(domainadminonlyFile);
379-
domainMap.put("loadBalancer", "VOYAGER");
380-
domainMap.put("loadBalancerWebPort", new Integer("30309"));
381-
logger.info(
382-
"domainadminonly loadBalancer is set to: "
383-
+ domainMap.get("loadBalancer")
384-
+ " with loadBalancerWebPort:"
385-
+ domainMap.get("loadBalancerWebPort"));
352+
TestUtils.domainMapUpdateWithLbInfor(domainMap, "VOYAGER", new Integer("30309"));
386353
domain = TestUtils.createDomain(domainMap);
387354
} else {
388355
domain = TestUtils.createDomain(domainadminonlyFile);
@@ -420,16 +387,9 @@ public void testCreateDomainPVReclaimPolicyRecycle() throws Exception {
420387
Domain domain = null;
421388

422389
try {
423-
// domain = TestUtils.createDomain(domainrecyclepolicyFile); TODO
424390
if (VOYAGER) {
425391
Map<String, Object> domainMap = TestUtils.loadYaml(domainrecyclepolicyFile);
426-
domainMap.put("loadBalancer", "VOYAGER");
427-
domainMap.put("loadBalancerWebPort", new Integer("30310"));
428-
logger.info(
429-
"domainrecyclepolicy loadBalancer is set to: "
430-
+ domainMap.get("loadBalancer")
431-
+ " with loadBalancerWebPort:"
432-
+ domainMap.get("loadBalancerWebPort"));
392+
TestUtils.domainMapUpdateWithLbInfor(domainMap, "VOYAGER", new Integer("30310"));
433393
domain = TestUtils.createDomain(domainMap);
434394
} else {
435395
domain = TestUtils.createDomain(domainrecyclepolicyFile);
@@ -466,16 +426,9 @@ public void testCreateDomainWithDefaultValuesInSampleInputs() throws Exception {
466426
Domain domain = null;
467427
boolean testCompletedSuccessfully = false;
468428
try {
469-
// domain = TestUtils.createDomain(domainsampledefaultsFile);TODO
470429
if (VOYAGER) {
471430
Map<String, Object> domainMap = TestUtils.loadYaml(domainsampledefaultsFile);
472-
domainMap.put("loadBalancer", "VOYAGER");
473-
domainMap.put("loadBalancerWebPort", new Integer("30311"));
474-
logger.info(
475-
"domainsampledefaultsFile loadBalancer is set to: "
476-
+ domainMap.get("loadBalancer")
477-
+ " with loadBalancerWebPort:"
478-
+ domainMap.get("loadBalancerWebPort"));
431+
TestUtils.domainMapUpdateWithLbInfor(domainMap, "VOYAGER", new Integer("30311"));
479432
domain = TestUtils.createDomain(domainMap);
480433
} else {
481434
domain = TestUtils.createDomain(domainsampledefaultsFile);
@@ -525,13 +478,7 @@ public void testAutoAndCustomSitConfigOverrides() throws Exception {
525478
domainMap.put("adminNodePort", new Integer("30704"));
526479
domainMap.put("t3ChannelPort", new Integer("30051"));
527480
if (VOYAGER) {
528-
domainMap.put("loadBalancer", "VOYAGER");
529-
domainMap.put("loadBalancerWebPort", new Integer("30312"));
530-
logger.info(
531-
" AutoAndCustomSitConfigOverrides loadBalancer is set to: "
532-
+ domainMap.get("loadBalancer")
533-
+ " with loadBalancerWebPort:"
534-
+ domainMap.get("loadBalancerWebPort"));
481+
TestUtils.domainMapUpdateWithLbInfor(domainMap, "VOYAGER", new Integer("30312"));
535482
}
536483
// use NFS for this domain on Jenkins, defaultis HOST_PATH
537484
if (System.getenv("JENKINS") != null && System.getenv("JENKINS").equalsIgnoreCase("true")) {

integration-tests/src/test/java/oracle/kubernetes/operator/utils/TestUtils.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,18 @@ public static Map<String, Object> loadYaml(String yamlFile) throws Exception {
561561
return map;
562562
}
563563

564+
// This method is to set a certain LB type with an unique lbWebPort
565+
public static void domainMapUpdateWithLbInfor(
566+
Map<String, Object> domainMap, String lbType, Integer lbWebPort) throws Exception {
567+
domainMap.put("loadBalancer", lbType);
568+
domainMap.put("loadBalancerWebPort", lbWebPort);
569+
logger.info(
570+
" loadBalancer is set to: "
571+
+ domainMap.get("loadBalancer")
572+
+ " with loadBalancerWebPort:"
573+
+ domainMap.get("loadBalancerWebPort"));
574+
}
575+
564576
public static Properties loadProps(String propsFile) throws Exception {
565577
Properties props = new Properties();
566578
// check file exists

0 commit comments

Comments
 (0)