Skip to content

Commit 0079379

Browse files
committed
tests optimization and some code refactoring
1 parent 6a09517 commit 0079379

20 files changed

+222
-601
lines changed

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

Lines changed: 171 additions & 357 deletions
Large diffs are not rendered by default.

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

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ public class Domain {
6464
private static int waitTime = BaseTest.getWaitTimePod();
6565

6666
public Domain(String inputYaml) throws Exception {
67+
// read input domain yaml to test
68+
this(TestUtils.loadYaml(inputYaml));
69+
}
6770

68-
initialize(inputYaml);
71+
public Domain(Map<String, Object> inputDomainMap) throws Exception {
72+
initialize(inputDomainMap);
6973
createPV();
7074
createSecret();
7175
generateInputYaml();
@@ -698,16 +702,8 @@ private void createPV() throws Exception {
698702
weblogicDomainStorageReclaimPolicy = (String) pvMap.get("weblogicDomainStorageReclaimPolicy");
699703
weblogicDomainStorageSize = (String) pvMap.get("weblogicDomainStorageSize");
700704

701-
// test NFS for domain5 on JENKINS
702-
if (domainUid.equals("domain6")
703-
&& (System.getenv("JENKINS") != null
704-
&& System.getenv("JENKINS").equalsIgnoreCase("true"))) {
705-
pvMap.put("weblogicDomainStorageType", "NFS");
706-
pvMap.put("weblogicDomainStorageNFSServer", TestUtils.getHostName());
707-
} else {
708-
pvMap.put("weblogicDomainStorageType", "HOST_PATH");
709-
pvMap.put("weblogicDomainStorageNFSServer", TestUtils.getHostName());
710-
}
705+
pvMap.put("weblogicDomainStorageNFSServer", TestUtils.getHostName());
706+
711707
// set pv path
712708
domainMap.put(
713709
"weblogicDomainStoragePath",
@@ -820,7 +816,7 @@ private void createLoadBalancer() throws Exception {
820816

821817
loadBalancer = (String) lbMap.get("loadBalancer");
822818

823-
if (domainUid.equals("domain7") && loadBalancer.equals("APACHE")) {
819+
if (loadBalancer.equals("APACHE")) {
824820
/* lbMap.put("loadBalancerAppPrepath", "/weblogic");
825821
lbMap.put("loadBalancerExposeAdminPort", new Boolean(true)); */
826822
}
@@ -943,12 +939,11 @@ private void callWebAppAndCheckForServerNameInResponse(
943939
}
944940
}
945941

946-
private void initialize(String inputYaml) throws Exception {
942+
private void initialize(Map<String, Object> inputDomainMap) throws Exception {
943+
domainMap = inputDomainMap;
947944
this.userProjectsDir = BaseTest.getUserProjectsDir();
948945
this.projectRoot = BaseTest.getProjectRoot();
949946

950-
// read input domain yaml to test
951-
domainMap = TestUtils.loadYaml(inputYaml);
952947
domainMap.put("domainName", domainMap.get("domainUID"));
953948

954949
// read sample domain inputs
@@ -990,9 +985,9 @@ private void initialize(String inputYaml) throws Exception {
990985

991986
domainMap.put("domainHome", "/shared/domains/" + domainUid);
992987
domainMap.put("logHome", "/shared/logs/" + domainUid);
993-
domainMap.put(
994-
"createDomainFilesDir",
995-
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv");
988+
/* domainMap.put(
989+
"createDomainFilesDir",
990+
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv"); */
996991
String imageName = "store/oracle/weblogic";
997992
if (System.getenv("IMAGE_NAME_WEBLOGIC") != null) {
998993
imageName = System.getenv("IMAGE_NAME_WEBLOGIC");

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,11 @@ public static Operator createOperator(String opYamlFile) throws Exception {
500500
public static Domain createDomain(String inputYaml) throws Exception {
501501
logger.info("Creating domain with yaml, waiting for the script to complete execution");
502502
return new Domain(inputYaml);
503-
/* domain.verifyDomainCreated();
504-
return domain; */
503+
}
504+
505+
public static Domain createDomain(Map<String, Object> inputDomainMap) throws Exception {
506+
logger.info("Creating domain with Map, waiting for the script to complete execution");
507+
return new Domain(inputDomainMap);
505508
}
506509

507510
public static Map<String, Object> loadYaml(String yamlFile) throws Exception {

integration-tests/src/test/resources/domain3.yaml renamed to integration-tests/src/test/resources/DomainOnPVUsingWDT.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
33

44
adminServerName: admin-server
5-
domainUID: domain3
5+
domainUID: domainonpvwdt
66
clusterName: cluster-1
77
configuredManagedServerCount: 4
88
initialManagedServerReplicas: 2
99
managedServerNameBase: managed-server
1010
#weblogicDomainStoragePath will be ignored, PV dir will be created at /<baseDir>/<USER>/acceptance_test_pv
1111
#weblogicDomainStoragePath: /scratch/external-domain-home/pv001/
1212
exposeAdminT3Channel: true
13-
t3ChannelPort: 30041
13+
t3ChannelPort: 30091
1414
exposeAdminNodePort: true
15-
adminNodePort: 30703
16-
namespace: test1
15+
adminNodePort: 30708
16+
namespace: test2
1717
createDomainFilesDir: wdt
18+
#loadBalancer: APACHE
19+
#loadBalancerWebPort: 30311
20+
#loadBalancerDashboardPort: 30321

integration-tests/src/test/resources/domain1.yaml renamed to integration-tests/src/test/resources/DomainOnPVUsingWLST.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
33

44
adminServerName: admin-server
5-
domainUID: domain1
5+
domainUID: domainonpvwlst
66
clusterName: cluster-1
77
configuredManagedServerCount: 4
88
initialManagedServerReplicas: 2
@@ -12,3 +12,4 @@ managedServerNameBase: managed-server
1212
exposeAdminT3Channel: true
1313
exposeAdminNodePort: true
1414
namespace: default
15+

integration-tests/src/test/resources/domain12.yaml renamed to integration-tests/src/test/resources/DomainWithAutoAndCustomSitConfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
33

4-
domainUID: domain12
4+
domainUID: domainwithsitconfig
55
namespace: default
66
configuredManagedServerCount: 4
77
initialManagedServerReplicas: 2

integration-tests/src/test/resources/domain6.yaml renamed to integration-tests/src/test/resources/DomainWithServerStartPolicyAsAdminOnly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
33

44
adminServerName: admin-server
5-
domainUID: domain6
5+
domainUID: domainwithadminonly
66
clusterName: cluster-1
77
configuredManagedServerCount: 4
88
initialManagedServerReplicas: 2

integration-tests/src/test/resources/domain7.yaml renamed to integration-tests/src/test/resources/DomainWithStorageReclaimPolicyRecycle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
33

44
adminServerName: admin-server
5-
domainUID: domain7
5+
domainUID: domainwithreclaimpolicy
66
clusterName: cluster-1
77
configuredManagedServerCount: 4
88
initialManagedServerReplicas: 2

0 commit comments

Comments
 (0)