Skip to content

Commit b8c58cb

Browse files
committed
Merge branch 'develop' into sitconfigtests2
Signed-off-by: sankar <[email protected]>
2 parents af985a4 + 9a80b83 commit b8c58cb

File tree

10 files changed

+71
-329
lines changed

10 files changed

+71
-329
lines changed

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

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
package oracle.kubernetes.operator;
66

7-
import java.io.File;
8-
import java.nio.file.Files;
9-
import java.nio.file.StandardCopyOption;
107
import java.util.Map;
118
import oracle.kubernetes.operator.utils.Domain;
129
import oracle.kubernetes.operator.utils.ExecCommand;
@@ -400,7 +397,7 @@ public void testCreateDomainWithDefaultValuesInSampleInputs() throws Exception {
400397
*
401398
* @throws Exception
402399
*/
403-
// @Test
400+
@Test
404401
public void testAutoAndCustomSitConfigOverrides() throws Exception {
405402
Assume.assumeFalse(QUICKTEST);
406403
String testMethod = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -411,8 +408,6 @@ public void testAutoAndCustomSitConfigOverrides() throws Exception {
411408
}
412409
Domain domain11 = null;
413410
boolean testCompletedSuccessfully = false;
414-
String createDomainScriptDir =
415-
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv";
416411
try {
417412
// load input yaml to map and add configOverrides
418413
Map<String, Object> domainMap = TestUtils.loadYaml(domainonpvwlstFile);
@@ -423,33 +418,23 @@ public void testAutoAndCustomSitConfigOverrides() throws Exception {
423418
domainMap.put("domainUID", "customsitdomain");
424419
domainMap.put("adminNodePort", new Integer("30704"));
425420
domainMap.put("t3ChannelPort", new Integer("30051"));
421+
domainMap.put(
422+
"createDomainPyScript",
423+
"integration-tests/src/test/resources/domain-home-on-pv/create-domain-auto-custom-sit-config.py");
426424
domainMap.put("voyagerWebPort", new Integer("30312"));
425+
427426
// use NFS for this domain on Jenkins, defaultis HOST_PATH
428427
if (System.getenv("JENKINS") != null && System.getenv("JENKINS").equalsIgnoreCase("true")) {
429428
domainMap.put("weblogicDomainStorageType", "NFS");
430429
}
431430

432-
// cp py
433-
Files.copy(
434-
new File(createDomainScriptDir + "/create-domain.py").toPath(),
435-
new File(createDomainScriptDir + "/create-domain.py.bak").toPath(),
436-
StandardCopyOption.REPLACE_EXISTING);
437-
Files.copy(
438-
new File(createDomainScriptDir + "/create-domain-auto-custom-sit-config.py").toPath(),
439-
new File(createDomainScriptDir + "/create-domain.py").toPath(),
440-
StandardCopyOption.REPLACE_EXISTING);
441-
442431
domain11 = TestUtils.createDomain(domainMap);
443432
domain11.verifyDomainCreated();
444433
testBasicUseCases(domain11);
445434
testAdminT3ChannelWithJMS(domain11);
446435
testCompletedSuccessfully = true;
447436

448437
} finally {
449-
Files.copy(
450-
new File(createDomainScriptDir + "/create-domain.py.bak").toPath(),
451-
new File(createDomainScriptDir + "/create-domain.py").toPath(),
452-
StandardCopyOption.REPLACE_EXISTING);
453438
if (domain11 != null && (JENKINS || testCompletedSuccessfully)) {
454439
domain11.destroy();
455440
}

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

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -241,53 +241,26 @@ private static Domain createSitConfigDomain() throws Exception {
241241
domainMap.put("domainUID", DOMAINUID);
242242
domainMap.put("adminNodePort", new Integer(ADMINPORT));
243243
domainMap.put("t3ChannelPort", new Integer(T3CHANNELPORT));
244+
domainMap.put(
245+
"createDomainPyScript",
246+
"integration-tests/src/test/resources/sitconfig/scripts/create-domain-auto-custom-sit-config20.py");
244247

245248
// use NFS for this domain on Jenkins, defaultis HOST_PATH
246249
if (System.getenv("JENKINS") != null && System.getenv("JENKINS").equalsIgnoreCase("true")) {
247250
domainMap.put("weblogicDomainStorageType", "NFS");
248251
}
249-
// copy the custom domain create script file
250-
backuprestoreDomainCreateFile("backup");
251-
Files.copy(
252-
new File(TESTSCRIPTDIR + "/sitconfig/scripts/create-domain-auto-custom-sit-config20.py")
253-
.toPath(),
254-
new File(createDomainScript).toPath(),
255-
StandardCopyOption.REPLACE_EXISTING);
256252
copyOverrideFiles();
257253
domain = TestUtils.createDomain(domainMap);
258254
domain.verifyDomainCreated();
259255
return domain;
260256
}
261257

262258
private static void destroySitConfigDomain() throws Exception {
263-
backuprestoreDomainCreateFile("restore");
264259
if (domain != null) {
265260
domain.destroy();
266261
}
267262
}
268263

269-
private static void backuprestoreDomainCreateFile(String op) throws IOException {
270-
String createDomainScriptDir = TESTSCRIPTDIR + "/domain-home-on-pv";
271-
String srcFileName;
272-
String dstFileName;
273-
switch (op) {
274-
case "backup":
275-
srcFileName = createDomainScriptDir + "/create-domain.py";
276-
dstFileName = createDomainScriptDir + "/create-domain.py.bak";
277-
break;
278-
case "restore":
279-
srcFileName = createDomainScriptDir + "/create-domain.py.bak";
280-
dstFileName = createDomainScriptDir + "/create-domain.py";
281-
break;
282-
default:
283-
return;
284-
}
285-
Files.copy(
286-
new File(srcFileName).toPath(),
287-
new File(dstFileName).toPath(),
288-
StandardCopyOption.REPLACE_EXISTING);
289-
}
290-
291264
private static void copyOverrideFiles() throws IOException {
292265
String files[] = {
293266
"config.xml",

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

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,8 @@ private void createPV() throws Exception {
818818
InputStream pv_is =
819819
new FileInputStream(
820820
new File(
821-
BaseTest.getProjectRoot()
822-
+ "/kubernetes/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc-inputs.yaml"));
821+
BaseTest.getResultDir()
822+
+ "/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc-inputs.yaml"));
823823
pvMap = yaml.load(pv_is);
824824
pv_is.close();
825825
pvMap.put("domainUID", domainUid);
@@ -890,21 +890,38 @@ private void generateInputYaml() throws Exception {
890890
}
891891

892892
private void callCreateDomainScript(String outputDir) throws Exception {
893-
StringBuffer createDomainScriptCmd = new StringBuffer(BaseTest.getProjectRoot());
894893

894+
// copy create domain py script for domain on pv case
895+
if (domainMap.containsKey("createDomainPyScript")
896+
&& !domainMap.containsKey("domainHomeImageBase")) {
897+
Files.copy(
898+
new File(BaseTest.getProjectRoot() + "/" + domainMap.get("createDomainPyScript"))
899+
.toPath(),
900+
new File(
901+
BaseTest.getResultDir()
902+
+ "/samples/scripts/create-weblogic-domain/domain-home-on-pv/wlst/create-domain.py")
903+
.toPath(),
904+
StandardCopyOption.REPLACE_EXISTING);
905+
}
906+
907+
StringBuffer createDomainScriptCmd = new StringBuffer(BaseTest.getResultDir());
908+
909+
// call different create-domain.sh based on the domain type
895910
if (domainMap.containsKey("domainHomeImageBase")) {
896-
// clone docker sample from github
911+
912+
// clone docker sample from github and copy create domain py script for domain in image case
897913
gitCloneDockerImagesSample(domainMap);
914+
898915
createDomainScriptCmd
899916
.append(
900-
"/kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain.sh -u ")
917+
"/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain.sh -u ")
901918
.append(BaseTest.getUsername())
902919
.append(" -p ")
903920
.append(BaseTest.getPassword())
904921
.append(" -k -i ");
905922
} else {
906923
createDomainScriptCmd.append(
907-
"/kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain.sh -v -i ");
924+
"/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain.sh -v -i ");
908925
}
909926
createDomainScriptCmd.append(generatedInputYamlFile);
910927

@@ -1130,27 +1147,31 @@ private void initialize(Map<String, Object> inputDomainMap) throws Exception {
11301147
domainMap = inputDomainMap;
11311148
this.userProjectsDir = BaseTest.getUserProjectsDir();
11321149
this.projectRoot = BaseTest.getProjectRoot();
1150+
1151+
// copy samples to RESULT_DIR
1152+
TestUtils.exec(
1153+
"cp -rf " + BaseTest.getProjectRoot() + "/kubernetes/samples " + BaseTest.getResultDir());
1154+
11331155
this.voyager =
11341156
System.getenv("LB_TYPE") != null && System.getenv("LB_TYPE").equalsIgnoreCase("VOYAGER");
11351157
if (System.getenv("INGRESSPERDOMAIN") != null) {
11361158
INGRESSPERDOMAIN = new Boolean(System.getenv("INGRESSPERDOMAIN")).booleanValue();
11371159
}
1160+
11381161
domainMap.put("domainName", domainMap.get("domainUID"));
11391162

11401163
// read sample domain inputs
11411164
String sampleDomainInputsFile =
1142-
"/kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml";
1165+
"/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml";
11431166
if (domainMap.containsKey("domainHomeImageBase")) {
11441167
sampleDomainInputsFile =
1145-
"/kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain-inputs.yaml";
1168+
"/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain-inputs.yaml";
11461169
}
11471170
Yaml dyaml = new Yaml();
11481171
InputStream sampleDomainInputStream =
1149-
new FileInputStream(new File(BaseTest.getProjectRoot() + sampleDomainInputsFile));
1172+
new FileInputStream(new File(BaseTest.getResultDir() + sampleDomainInputsFile));
11501173
logger.info(
1151-
"loading domain inputs template file "
1152-
+ BaseTest.getProjectRoot()
1153-
+ sampleDomainInputsFile);
1174+
"loading domain inputs template file " + BaseTest.getResultDir() + sampleDomainInputsFile);
11541175
Map<String, Object> sampleDomainMap = dyaml.load(sampleDomainInputStream);
11551176
sampleDomainInputStream.close();
11561177

@@ -1191,9 +1212,9 @@ private void initialize(Map<String, Object> inputDomainMap) throws Exception {
11911212
domainMap.put("logHome", "/shared/logs/" + domainUid);
11921213
if (!domainMap.containsKey("domainHomeImageBase")) {
11931214
domainMap.put("domainHome", "/shared/domains/" + domainUid);
1194-
domainMap.put(
1195-
"createDomainFilesDir",
1196-
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv");
1215+
/* domainMap.put(
1216+
"createDomainFilesDir",
1217+
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv"); */
11971218
domainMap.put("image", imageName + ":" + imageTag);
11981219
}
11991220

@@ -1359,14 +1380,15 @@ private void gitCloneDockerImagesSample(Map domainMap) throws Exception {
13591380
+ " "
13601381
+ result.stdout());
13611382
}
1362-
// copy script to cloned location
1363-
Files.copy(
1364-
new File(
1365-
BaseTest.getProjectRoot()
1366-
+ "/integration-tests/src/test/resources/domain-home-on-image/create-wls-domain.py")
1367-
.toPath(),
1368-
new File(domainHomeImageBuildPath + "/container-scripts/create-wls-domain.py").toPath(),
1369-
StandardCopyOption.REPLACE_EXISTING);
1383+
1384+
// copy create domain py script to cloned location
1385+
if (domainMap.containsKey("createDomainPyScript")) {
1386+
Files.copy(
1387+
new File(BaseTest.getProjectRoot() + "/" + domainMap.get("createDomainPyScript"))
1388+
.toPath(),
1389+
new File(domainHomeImageBuildPath + "/container-scripts/create-wls-domain.py").toPath(),
1390+
StandardCopyOption.REPLACE_EXISTING);
1391+
}
13701392
}
13711393
}
13721394

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public PersistentVolume(String dirPath, Map pvMap) throws Exception {
4949

5050
// create PV/PVC
5151
String cmdPvPvc =
52-
BaseTest.getProjectRoot()
53-
+ "/kubernetes/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc.sh "
52+
BaseTest.getResultDir()
53+
+ "/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc.sh "
5454
+ " -i "
5555
+ parentDir
5656
+ "/"

0 commit comments

Comments
 (0)