Skip to content

Commit 1c32699

Browse files
authored
Merge pull request #1151 from oracle/owls75767
Set up Jenkin Nightly to certify WLS 12.2.1.4.0 against Operator
2 parents ea38409 + 8f1de47 commit 1c32699

File tree

8 files changed

+54
-64
lines changed

8 files changed

+54
-64
lines changed

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import java.nio.file.Files;
88
import java.nio.file.Paths;
9+
import java.nio.file.StandardCopyOption;
910
import java.util.Map;
1011
import java.util.Properties;
1112
import java.util.logging.FileHandler;
@@ -687,14 +688,7 @@ public void testWldfScaling(Operator operator, Domain domain) throws Exception {
687688
String adminPodName = domainUid + "-" + adminServerName;
688689
String domainName = (String) domainMap.get("domainName");
689690

690-
String scriptsDir =
691-
"/scratch/acceptance_test_pv/persistentVolume-"
692-
+ domainUid
693-
+ "/domains/"
694-
+ domainUid
695-
+ "/bin/scripts";
696-
697-
copyScalingScriptToPod(scriptsDir, domainUid, adminPodName, domainNS);
691+
copyScalingScriptToPod( domainUid, adminPodName, domainNS);
698692
TestUtils.createRbacPoliciesForWldfScaling();
699693

700694
// deploy opensessionapp
@@ -752,18 +746,23 @@ protected void logTestBegin(String testName) throws Exception {
752746
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
753747
}
754748

755-
private void copyScalingScriptToPod(
756-
String dirPathToCreate, String domainUid, String podName, String domainNS) throws Exception {
749+
private void copyScalingScriptToPod(String domainUid, String podName, String domainNS)
750+
throws Exception {
751+
752+
String pvDir = BaseTest.getPvRoot() + "/acceptance_test_pv/persistentVolume-" + domainUid;
753+
String scriptsDir = pvDir + "/domains/" + domainUid + "/bin/scripts";
757754

758755
// create scripts dir under domain pv
759-
TestUtils.createDirUnderDomainPV(dirPathToCreate);
760-
756+
TestUtils.createDirUnderDomainPV(scriptsDir);
757+
// workaround for the issue with not allowing .. in the host-path in krun.sh
758+
Files.copy(Paths.get(getProjectRoot() + "/src/scripts/scaling/scalingAction.sh"),
759+
Paths.get(getResultDir()+"/scalingAction.sh"), StandardCopyOption.REPLACE_EXISTING);
761760
// copy script to pod
762-
TestUtils.copyFileViaCat(
763-
getProjectRoot() + "/src/scripts/scaling/scalingAction.sh",
764-
"/shared/domains/" + domainUid + "/bin/scripts/scalingAction.sh",
765-
podName,
766-
domainNS);
761+
String cpUsingKrunCmd = getProjectRoot() + "/src/integration-tests/bash/krun.sh -m "
762+
+ getResultDir() + ":/tmpdir -m " + pvDir
763+
+ ":/pvdir -c 'cp -f /tmpdir/scalingAction.sh /pvdir/domains/domainonpvwdt/bin/scripts' -n "
764+
+ domainNS;
765+
TestUtils.exec(cpUsingKrunCmd, true);
767766
}
768767

769768
private void callWebAppAndVerifyScaling(Domain domain, int replicas) throws Exception {

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import java.nio.file.Paths;
1313
import java.util.Map;
1414
import java.util.logging.Level;
15-
1615
import oracle.kubernetes.operator.utils.Domain;
1716
import oracle.kubernetes.operator.utils.ExecResult;
1817
import oracle.kubernetes.operator.utils.Operator;
@@ -34,6 +33,9 @@ public class ItSitConfig extends BaseTest {
3433
private static String ADMINPODNAME;
3534
private static String fqdn;
3635
private static String JDBC_URL;
36+
private static final String JDBC_DRIVER_NEW = "com.mysql.cj.jdbc.Driver";
37+
private static final String JDBC_DRIVER_OLD = "com.mysql.jdbc.Driver";
38+
private static final String PS3_TAG = "12.2.1.3";
3739
private static String KUBE_EXEC_CMD;
3840
private static Domain domain;
3941
private static Operator operator1;
@@ -171,6 +173,9 @@ private static void copySitConfigFiles() throws IOException {
171173
Charset charset = StandardCharsets.UTF_8;
172174
String content = new String(Files.readAllBytes(path), charset);
173175
content = content.replaceAll("JDBC_URL", JDBC_URL);
176+
if (getWeblogicImageTag().contains(PS3_TAG)) {
177+
content = content.replaceAll(JDBC_DRIVER_NEW, JDBC_DRIVER_OLD);
178+
}
174179
path = Paths.get(dstDir, file);
175180
logger.log(Level.INFO, "to {0}", path.toString());
176181
Files.write(path, content.getBytes(charset));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ protected void createPv() throws Exception {
950950
pvMap.values().removeIf(Objects::isNull);
951951

952952
// k8s job mounts PVROOT /scratch/<usr>/wl_k8s_test_results to /scratch, create PV/PVC
953-
new PersistentVolume("/scratch/acceptance_test_pv/persistentVolume-" + domainUid, pvMap);
953+
new PersistentVolume(BaseTest.getPvRoot() +"acceptance_test_pv/persistentVolume-" + domainUid, pvMap);
954954

955955
String cmd =
956956
BaseTest.getProjectRoot()

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

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,15 @@ public class PersistentVolume {
2121
public PersistentVolume(String dirPath, Map pvMap) throws Exception {
2222
this.dirPath = dirPath;
2323
this.pvMap = pvMap;
24-
24+
2525
String cmd =
26-
BaseTest.getProjectRoot()
27-
+ "/src/integration-tests/bash/job.sh \"mkdir -m 777 -p "
28-
+ dirPath
29-
+ "\"";
30-
31-
ExecResult result = ExecCommand.exec(cmd);
32-
if (result.exitValue() != 0) {
33-
throw new RuntimeException(
34-
"FAILURE: command to create domain PV directory "
35-
+ cmd
36-
+ " failed, returned "
37-
+ result.stdout()
38-
+ result.stderr());
39-
}
40-
logger.info("command result " + result.stdout().trim());
26+
BaseTest.getProjectRoot()
27+
+ "/src/integration-tests/bash/krun.sh -m "+BaseTest.getPvRoot()
28+
+ ":/sharedparent -t 120 -c 'mkdir -m 777 -p "
29+
+ dirPath.replace(BaseTest.getPvRoot(), "/sharedparent/")
30+
+ "'";
31+
32+
TestUtils.exec(cmd, true);
4133

4234
Path parentDir =
4335
pvMap.get("domainUID") != null
@@ -60,16 +52,7 @@ public PersistentVolume(String dirPath, Map pvMap) throws Exception {
6052
+ BaseTest.getUserProjectsDir();
6153
logger.info("Executing cmd " + cmdPvPvc);
6254

63-
result = ExecCommand.exec(cmdPvPvc);
64-
if (result.exitValue() != 0) {
65-
throw new RuntimeException(
66-
"FAILURE: command to create PV/PVC "
67-
+ cmdPvPvc
68-
+ " failed, returned "
69-
+ result.stdout()
70-
+ result.stderr());
71-
}
72-
logger.info("command result " + result.stdout().trim());
55+
TestUtils.exec(cmdPvPvc, true);
7356
}
7457

7558
public String getDirPath() {

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

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,12 +1034,13 @@ public static void callShellScriptByExecToPod(
10341034
}
10351035

10361036
public static void createDirUnderDomainPV(String dirPath) throws Exception {
1037-
1037+
dirPath = dirPath.replace(BaseTest.getPvRoot(), "/sharedparent/");
10381038
String crdCmd =
10391039
BaseTest.getProjectRoot()
1040-
+ "/src/integration-tests/bash/job.sh \"mkdir -p "
1041-
+ dirPath
1042-
+ "\"";
1040+
+ "/src/integration-tests/bash/krun.sh -m "+BaseTest.getPvRoot()+":/sharedparent -c 'mkdir -m 777 -p "
1041+
+ dirPath
1042+
+ "'";
1043+
10431044
ExecResult result = ExecCommand.exec(crdCmd);
10441045
if (result.exitValue() != 0) {
10451046
throw new RuntimeException(
@@ -1058,31 +1059,33 @@ public static void createWldfModule(String adminPodName, String domainNS, int t3
10581059
// copy wldf.py script tp pod
10591060
copyFileViaCat(
10601061
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/wldf/wldf.py",
1061-
"/shared/wldf.py",
1062+
BaseTest.getAppLocationInPod() +"/wldf.py",
10621063
adminPodName,
10631064
domainNS);
10641065

10651066
// copy callpyscript.sh to pod
10661067
copyFileViaCat(
10671068
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/callpyscript.sh",
1068-
"/shared/callpyscript.sh",
1069+
BaseTest.getAppLocationInPod() + "/callpyscript.sh",
10691070
adminPodName,
10701071
domainNS);
10711072

10721073
// arguments to shell script to call py script
1073-
String arguments =
1074-
"/shared/wldf.py "
1075-
+ BaseTest.getUsername()
1076-
+ " "
1077-
+ BaseTest.getPassword()
1078-
+ " t3://"
1074+
1075+
String[] args = {
1076+
BaseTest.getAppLocationInPod() + "/wldf.py",
1077+
BaseTest.getUsername(),
1078+
BaseTest.getPassword(),
1079+
" t3://"
10791080
+ adminPodName
10801081
+ ":"
1081-
+ t3ChannelPort;
1082-
1082+
+ t3ChannelPort,
1083+
1084+
};
1085+
10831086
// call callpyscript.sh in pod to deploy wldf module
1084-
TestUtils.callShellScriptByExecToPod(
1085-
"/shared/callpyscript.sh", arguments, adminPodName, domainNS);
1087+
TestUtils.callShellScriptByExecToPod(
1088+
adminPodName, domainNS, BaseTest.getAppLocationInPod(), "callpyscript.sh", args);
10861089
}
10871090

10881091
public static void createRbacPoliciesForWldfScaling() throws Exception {

integration-tests/src/test/resources/setupenv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function get_wlthint3client_from_image {
175175
docker rm -v $id
176176

177177
}
178-
export OCR_SERVER=container-registry.oracle.com
178+
export OCR_SERVER="${OCR_SERVER:-container-registry.oracle.com}"
179179
export WLS_IMAGE_URI=/middleware/weblogic
180180
export SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
181181
export PROJECT_ROOT="$SCRIPTPATH/../../../.."

integration-tests/src/test/resources/sitconfig/configoverrides/jdbc-JdbcTestDataSource-0.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</jdbc:jdbc-connection-pool-params>
1414
<jdbc:jdbc-driver-params>
1515
<jdbc:url jdbcf:combine-mode="replace">JDBC_URL</jdbc:url>
16-
<jdbc:driver-name>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</jdbc:driver-name>
16+
<jdbc:driver-name jdbcf:combine-mode="replace">com.mysql.cj.jdbc.Driver</jdbc:driver-name>
1717
<jdbc:properties>
1818
<jdbc:property>
1919
<jdbc:name>user</jdbc:name>

integration-tests/src/test/resources/sitconfig/scripts/create-domain-auto-custom-sit-config20.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def createDataSource(dsName, dsJNDI, dsUrl, dsUser, dsPassword, dsTarget):
8383
cd('/JDBCSystemResource/' + dsName + '/JdbcResource/' + dsName)
8484
create('testDriverParams', 'JDBCDriverParams')
8585
cd('JDBCDriverParams/NO_NAME_0')
86-
set('DriverName', 'com.mysql.jdbc.jdbc2.optional.MysqlXADataSource')
86+
set('DriverName', 'com.mysql.cj.jdbc.Driver')
8787
set('URL', dsUrl)
8888
set('PasswordEncrypted', dsPassword)
8989

0 commit comments

Comments
 (0)