Skip to content

Commit f5bdbc9

Browse files
committed
new setenv.sh
1 parent 4f523c6 commit f5bdbc9

File tree

9 files changed

+147
-156
lines changed

9 files changed

+147
-156
lines changed

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package oracle.kubernetes.operator;
66

7+
import oracle.kubernetes.operator.utils.DBUtils;
78
import oracle.kubernetes.operator.utils.JRFDomain;
89
import oracle.kubernetes.operator.utils.Operator;
910
import oracle.kubernetes.operator.utils.OracleDB;
@@ -24,18 +25,11 @@
2425
public class JrfInOperatorTest extends BaseTest {
2526

2627
// property file used to customize operator properties for operator inputs yaml
27-
28-
private static String operator1File = "jrfoperator1.yaml";
29-
28+
private static final String JRF_OPERATOR_FILE_1 = "jrfoperator1.yaml";
3029
// file used to customize domain properties for domain, PV and LB inputs yaml
31-
private static String jrfdomainonpvwlstFile = "jrfdomainonpvwlst.yaml";
32-
30+
private static final String JRF_DOMAIN_ON_PV_WLST_FILE = "jrfdomainonpvwlst.yaml";
3331
// property file for oracle db information
34-
private static String dbPropsFile = "oracledb.properties";
35-
36-
// property file used to configure constants for integration tests
37-
private static String appPropsFile = "OperatorIT.properties";
38-
32+
private static final String DB_PROP_FILE = "oracledb.properties";
3933
private static Operator operator1;
4034

4135
/**
@@ -49,10 +43,10 @@ public class JrfInOperatorTest extends BaseTest {
4943
@BeforeClass
5044
public static void staticPrepare() throws Exception {
5145
// initialize test properties and create the directories
52-
initialize(appPropsFile);
46+
initialize(APP_PROPS_FILE);
5347

5448
// create DB used for jrf domain
55-
OracleDB db = TestUtils.createOracleDB(dbPropsFile);
49+
OracleDB db = DBUtils.createOracleDB(DB_PROP_FILE);
5650

5751
// populate the jrf/create-domain-script.sh
5852
// copy the integration-tests/src/test/resources/domain-home-on-pv/jrf to
@@ -110,7 +104,7 @@ public void testJRFDomainOnPVUsingWLST() throws Exception {
110104
logger.info("Creating Operator & waiting for the script to complete execution");
111105
// create operator1
112106
if (operator1 == null) {
113-
operator1 = TestUtils.createOperator(operator1File);
107+
operator1 = TestUtils.createOperator(JRF_OPERATOR_FILE_1);
114108
}
115109

116110
// TODO: reconsider the logic to check the db readiness
@@ -122,7 +116,7 @@ public void testJRFDomainOnPVUsingWLST() throws Exception {
122116
boolean testCompletedSuccessfully = false;
123117

124118
try {
125-
jrfdomain = new JRFDomain(jrfdomainonpvwlstFile);
119+
jrfdomain = new JRFDomain(JRF_DOMAIN_ON_PV_WLST_FILE);
126120
jrfdomain.verifyDomainCreated();
127121

128122
if (!SMOKETEST) {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at
3+
// http://oss.oracle.com/licenses/upl.
4+
5+
package oracle.kubernetes.operator.utils;
6+
7+
import java.util.logging.Logger;
8+
9+
public class DBUtils {
10+
private static final Logger logger = Logger.getLogger("OperatorIT", "OperatorIT");
11+
12+
/**
13+
* create oracle db pod in the k8s cluster
14+
*
15+
* @param dbPropsFile - db properties file
16+
* @return - OracleDB instance
17+
* @throws Exception - if any error occurs when creating Oracle DB pod
18+
*/
19+
public static OracleDB createOracleDB(String dbPropsFile) throws Exception {
20+
OracleDB oracledb = new OracleDB(dbPropsFile);
21+
22+
// check the db is ready
23+
String dbnamespace = oracledb.getNamespace();
24+
25+
String cmd = "kubectl get pod -n " + dbnamespace + " -o jsonpath=\"{.items[0].metadata.name}\"";
26+
ExecResult result = ExecCommand.exec(cmd);
27+
String podName = result.stdout();
28+
29+
logger.info("DEBUG: db namespace=" + dbnamespace);
30+
logger.info("DEBUG: podname=" + podName);
31+
TestUtils.checkPodReady("", dbnamespace);
32+
33+
// check the db is ready to use
34+
cmd = "kubectl logs " + podName + " -n " + dbnamespace;
35+
TestUtils.checkCmdInLoop(cmd, "The database is ready for use", podName);
36+
37+
return oracledb;
38+
}
39+
}

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

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,40 +38,40 @@ public class Domain {
3838
protected static final Logger logger = Logger.getLogger("OperatorIT", "OperatorIT");
3939

4040
protected Map<String, Object> domainMap;
41-
protected Map<String, Object> pvMap;
41+
private Map<String, Object> pvMap;
4242

4343
// attributes from domain properties
4444
protected String domainUid = "";
4545
// default values as in create-weblogic-domain-inputs.yaml, generated yaml file will have the
4646
// customized property values
47-
protected String domainNS;
48-
protected String adminServerName;
49-
protected String managedServerNameBase;
50-
protected int initialManagedServerReplicas;
51-
protected int configuredManagedServerCount;
52-
protected boolean exposeAdminT3Channel;
53-
protected boolean exposeAdminNodePort;
54-
protected int t3ChannelPort;
55-
protected String clusterName;
56-
protected String clusterType;
57-
protected String serverStartPolicy;
58-
protected String loadBalancer = "TRAEFIK";
59-
protected int loadBalancerWebPort = 30305;
60-
protected String domainHomeImageBuildPath = "";
47+
private String domainNS;
48+
private String adminServerName;
49+
private String managedServerNameBase;
50+
private int initialManagedServerReplicas;
51+
private int configuredManagedServerCount;
52+
private boolean exposeAdminT3Channel;
53+
private boolean exposeAdminNodePort;
54+
private int t3ChannelPort;
55+
private String clusterName;
56+
private String clusterType;
57+
private String serverStartPolicy;
58+
private String loadBalancer = "TRAEFIK";
59+
private int loadBalancerWebPort = 30305;
60+
private String domainHomeImageBuildPath = "";
6161
protected String userProjectsDir = "";
62-
protected String projectRoot = "";
63-
protected boolean ingressPerDomain = true;
62+
private String projectRoot = "";
63+
private boolean ingressPerDomain = true;
6464

65-
protected String generatedInputYamlFile;
65+
private String generatedInputYamlFile;
6666

67-
protected static int maxIterations = BaseTest.getMaxIterationsPod(); // 50 * 5 = 250 seconds
68-
protected static int waitTime = BaseTest.getWaitTimePod();
67+
private static int maxIterations = BaseTest.getMaxIterationsPod(); // 50 * 5 = 250 seconds
68+
private static int waitTime = BaseTest.getWaitTimePod();
6969

70-
protected boolean voyager;
70+
private boolean voyager;
7171
// LB_TYPE is an evn var. Set to "VOYAGER" to use it as loadBalancer
72-
protected static String LB_TYPE;
72+
private static String LB_TYPE;
7373
// set INGRESSPERDOMAIN to false to create LB's ingress by kubectl yaml file
74-
protected static boolean INGRESSPERDOMAIN = true;
74+
private static boolean INGRESSPERDOMAIN = true;
7575

7676
public Domain() throws Exception {
7777
domainMap = new HashMap<>();

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
/** JRF Domain class with all the utility methods */
1111
public class JRFDomain extends Domain {
1212

13-
private static final String FMWINFRA_DOCKER_IMAGENAME =
13+
private static final String DEFAULT_FMWINFRA_DOCKER_IMAGENAME =
1414
"phx.ocir.io/weblogick8s/oracle/fmw-infrastructure";
15-
private static final String FMWINFRA_DOCKER_IMAGETAG = "12.2.1.3";
15+
private static final String DEFAULT_FMWINFRA_DOCKER_IMAGETAG = "12.2.1.3";
1616

1717
/**
1818
* JRFDomain constructor
@@ -50,9 +50,9 @@ public JRFDomain(Map<String, Object> inputDomainMap) throws Exception {
5050
* @throws Exception - if any error occurs
5151
*/
5252
private void updateDomainMapForJRF() throws Exception {
53-
5453
// jrf specific input parameter
55-
domainMap.put("image", FMWINFRA_DOCKER_IMAGENAME + ":" + FMWINFRA_DOCKER_IMAGETAG);
54+
domainMap.put(
55+
"image", DEFAULT_FMWINFRA_DOCKER_IMAGENAME + ":" + DEFAULT_FMWINFRA_DOCKER_IMAGETAG);
5656

5757
if (!domainMap.containsKey("domainHomeImageBase")) {
5858
// update jrf/create-domain-script.sh with domain_name and rcuprefix
@@ -66,7 +66,7 @@ private void updateDomainMapForJRF() throws Exception {
6666
if (System.getenv("IMAGE_PULL_SECRET_FMWINFRA") != null) {
6767
domainMap.put("imagePullSecretName", System.getenv("IMAGE_PULL_SECRET_FMWINFRA"));
6868
} else {
69-
domainMap.put("imagePullSecretName", "ocir-store}");
69+
domainMap.put("imagePullSecretName", "ocir-store");
7070
}
7171
}
7272
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public OracleDB(String dbPropFile) throws Exception {
5151
if (!namespace.equalsIgnoreCase("default")) {
5252
command = "kubectl create ns " + namespace;
5353
logger.info("Running " + command);
54-
ExecCommand.exec(command);
54+
TestUtils.exec(command);
5555
}
5656

5757
// create db

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

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,34 +1057,6 @@ public static void verifyAfterDeletion(Domain domain) throws Exception {
10571057
k8sTestUtils.verifyNoClusterRoleBindings(domain1LabelSelector);
10581058
}
10591059

1060-
/**
1061-
* create oracle db pod in the k8s cluster
1062-
*
1063-
* @param dbPropsFile - db properties file
1064-
* @return - OracleDB instance
1065-
* @throws Exception - if any error occurs when creating Oracle DB pod
1066-
*/
1067-
public static OracleDB createOracleDB(String dbPropsFile) throws Exception {
1068-
OracleDB oracledb = new OracleDB(dbPropsFile);
1069-
1070-
// check the db is ready
1071-
String dbnamespace = oracledb.getNamespace();
1072-
1073-
String cmd = "kubectl get pod -n " + dbnamespace + " -o jsonpath=\"{.items[0].metadata.name}\"";
1074-
ExecResult result = ExecCommand.exec(cmd);
1075-
String podName = result.stdout();
1076-
1077-
logger.info("DEBUG: db namespace=" + dbnamespace);
1078-
logger.info("DEBUG: podname=" + podName);
1079-
TestUtils.checkPodReady("", dbnamespace);
1080-
1081-
// check the db is ready to use
1082-
cmd = "kubectl logs " + podName + " -n " + dbnamespace;
1083-
checkCmdInLoop(cmd, "The database is ready for use", podName);
1084-
1085-
return oracledb;
1086-
}
1087-
10881060
/**
10891061
* Replaces the string matching the given search pattern with a new string.
10901062
*
@@ -1128,7 +1100,7 @@ private static KeyStore createKeyStore(Operator operator) throws Exception {
11281100
return myKeyStore;
11291101
}
11301102

1131-
private static void checkCmdInLoop(String cmd, String matchStr, String k8sObjName)
1103+
public static void checkCmdInLoop(String cmd, String matchStr, String k8sObjName)
11321104
throws Exception {
11331105
int i = 0;
11341106
while (i < BaseTest.getMaxIterationsPod()) {

integration-tests/src/test/resources/domain-home-on-pv/jrf/create-domain-script.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ then
164164
echo "RCU Ignore error"
165165
else
166166
echo "RCU Loading Failed.. Please check the RCU logs"
167-
echo "sleeping for debugging ..."
168-
sleep 2h
169167
exit
170168
fi
171169
fi

integration-tests/src/test/resources/jrfdomainonpvwlst.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,10 @@ clusterName: infracluster
99
configuredManagedServerCount: 1
1010
initialManagedServerReplicas: 1
1111
managedServerNameBase: infraserver
12-
#weblogicDomainStoragePath will be ignored, PV dir will be created at /<baseDir>/<USER>/acceptance_test_pv
13-
#weblogicDomainStoragePath: /scratch/external-domain-home/pv001/
1412
exposeAdminT3Channel: true
1513
t3ChannelPort: 30013
1614
exposeAdminNodePort: true
1715
namespace: jrfdomains
18-
#loadBalancer: TRAEFIK
19-
#ingressPerDomain: true
20-
#createDomainPyScript: integration-tests/src/test/resources/domain-home-on-pv/create-domain-custom-nap.py
21-
#voyagerWebPort: 30305
2216
image: phx.ocir.io/weblogick8s/oracle/fmw-infrastructure:12.2.1.3
2317
logHome: /shared/logs/jrfdomain1
2418
createDomainScriptsMountPath: /u01/weblogic

0 commit comments

Comments
 (0)