Skip to content

Commit fe01a1c

Browse files
committed
copy samples dir, add new prop
1 parent 673800b commit fe01a1c

File tree

6 files changed

+36
-36
lines changed

6 files changed

+36
-36
lines changed

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

Lines changed: 3 additions & 19 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;
@@ -427,8 +424,6 @@ public void testAutoAndCustomSitConfigOverrides() throws Exception {
427424
}
428425
Domain domain11 = null;
429426
boolean testCompletedSuccessfully = false;
430-
String createDomainScriptDir =
431-
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv";
432427
try {
433428
// load input yaml to map and add configOverrides
434429
Map<String, Object> domainMap = TestUtils.loadYaml(domainonpvwlstFile);
@@ -439,32 +434,21 @@ public void testAutoAndCustomSitConfigOverrides() throws Exception {
439434
domainMap.put("domainUID", "customsitdomain");
440435
domainMap.put("adminNodePort", new Integer("30704"));
441436
domainMap.put("t3ChannelPort", new Integer("30051"));
437+
domainMap.put(
438+
"createDomainPyScript",
439+
"integration-tests/src/test/resources/domain-home-on-pv/create-domain-auto-custom-sit-config.py");
442440
// use NFS for this domain on Jenkins, defaultis HOST_PATH
443441
if (System.getenv("JENKINS") != null && System.getenv("JENKINS").equalsIgnoreCase("true")) {
444442
domainMap.put("weblogicDomainStorageType", "NFS");
445443
}
446444

447-
// cp py
448-
Files.copy(
449-
new File(createDomainScriptDir + "/create-domain.py").toPath(),
450-
new File(createDomainScriptDir + "/create-domain.py.bak").toPath(),
451-
StandardCopyOption.REPLACE_EXISTING);
452-
Files.copy(
453-
new File(createDomainScriptDir + "/create-domain-auto-custom-sit-config.py").toPath(),
454-
new File(createDomainScriptDir + "/create-domain.py").toPath(),
455-
StandardCopyOption.REPLACE_EXISTING);
456-
457445
domain11 = TestUtils.createDomain(domainMap);
458446
domain11.verifyDomainCreated();
459447
testBasicUseCases(domain11);
460448
testAdminT3ChannelWithJMS(domain11);
461449
testCompletedSuccessfully = true;
462450

463451
} finally {
464-
Files.copy(
465-
new File(createDomainScriptDir + "/create-domain.py.bak").toPath(),
466-
new File(createDomainScriptDir + "/create-domain.py").toPath(),
467-
StandardCopyOption.REPLACE_EXISTING);
468452
if (domain11 != null && (JENKINS || testCompletedSuccessfully)) {
469453
domain11.destroy();
470454
}

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

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,8 @@ private void createPV() throws Exception {
804804
InputStream pv_is =
805805
new FileInputStream(
806806
new File(
807-
BaseTest.getProjectRoot()
808-
+ "/kubernetes/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc-inputs.yaml"));
807+
BaseTest.getResultDir()
808+
+ "/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc-inputs.yaml"));
809809
pvMap = yaml.load(pv_is);
810810
pv_is.close();
811811
pvMap.put("domainUID", domainUid);
@@ -876,21 +876,33 @@ private void generateInputYaml() throws Exception {
876876
}
877877

878878
private void callCreateDomainScript(String outputDir) throws Exception {
879-
StringBuffer createDomainScriptCmd = new StringBuffer(BaseTest.getProjectRoot());
880879

880+
// copy create domain py script
881+
if (domainMap.containsKey("createDomainPyScript")) {
882+
Files.copy(
883+
new File(BaseTest.getProjectRoot() + "/" + domainMap.get("createDomainPyScript"))
884+
.toPath(),
885+
new File(
886+
BaseTest.getResultDir()
887+
+ "/samples/scripts/create-weblogic-domain/domain-home-on-pv/wlst/create-domain.py")
888+
.toPath(),
889+
StandardCopyOption.REPLACE_EXISTING);
890+
}
891+
892+
StringBuffer createDomainScriptCmd = new StringBuffer(BaseTest.getResultDir());
881893
if (domainMap.containsKey("domainHomeImageBase")) {
882894
// clone docker sample from github
883895
gitCloneDockerImagesSample(domainMap);
884896
createDomainScriptCmd
885897
.append(
886-
"/kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain.sh -u ")
898+
"/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain.sh -u ")
887899
.append(BaseTest.getUsername())
888900
.append(" -p ")
889901
.append(BaseTest.getPassword())
890902
.append(" -k -i ");
891903
} else {
892904
createDomainScriptCmd.append(
893-
"/kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain.sh -v -i ");
905+
"/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain.sh -v -i ");
894906
}
895907
createDomainScriptCmd.append(generatedInputYamlFile);
896908

@@ -1090,22 +1102,24 @@ private void initialize(Map<String, Object> inputDomainMap) throws Exception {
10901102
this.userProjectsDir = BaseTest.getUserProjectsDir();
10911103
this.projectRoot = BaseTest.getProjectRoot();
10921104

1105+
// copy samples to RESULT_DIR
1106+
TestUtils.exec(
1107+
"cp -r " + BaseTest.getProjectRoot() + "/kubernetes/samples " + BaseTest.getResultDir());
1108+
10931109
domainMap.put("domainName", domainMap.get("domainUID"));
10941110

10951111
// read sample domain inputs
10961112
String sampleDomainInputsFile =
1097-
"/kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml";
1113+
"/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-inputs.yaml";
10981114
if (domainMap.containsKey("domainHomeImageBase")) {
10991115
sampleDomainInputsFile =
1100-
"/kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain-inputs.yaml";
1116+
"/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain-inputs.yaml";
11011117
}
11021118
Yaml dyaml = new Yaml();
11031119
InputStream sampleDomainInputStream =
1104-
new FileInputStream(new File(BaseTest.getProjectRoot() + sampleDomainInputsFile));
1120+
new FileInputStream(new File(BaseTest.getResultDir() + sampleDomainInputsFile));
11051121
logger.info(
1106-
"loading domain inputs template file "
1107-
+ BaseTest.getProjectRoot()
1108-
+ sampleDomainInputsFile);
1122+
"loading domain inputs template file " + BaseTest.getResultDir() + sampleDomainInputsFile);
11091123
Map<String, Object> sampleDomainMap = dyaml.load(sampleDomainInputStream);
11101124
sampleDomainInputStream.close();
11111125

@@ -1146,9 +1160,9 @@ private void initialize(Map<String, Object> inputDomainMap) throws Exception {
11461160
domainMap.put("logHome", "/shared/logs/" + domainUid);
11471161
if (!domainMap.containsKey("domainHomeImageBase")) {
11481162
domainMap.put("domainHome", "/shared/domains/" + domainUid);
1149-
domainMap.put(
1150-
"createDomainFilesDir",
1151-
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv");
1163+
/* domainMap.put(
1164+
"createDomainFilesDir",
1165+
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv"); */
11521166
domainMap.put("image", imageName + ":" + imageTag);
11531167
}
11541168

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
+ "/"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ exposeAdminNodePort: true
1616
namespace: default
1717
loadBalancer: TRAEFIK
1818
ingressPerDomain: true
19-
19+
createDomainPyScript: integration-tests/src/test/resources/domain-home-on-pv/create-domain-custom-nap.py

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ function state_dump {
142142
# remove docker-images project before archiving
143143
rm -rf ${RESULT_DIR}/docker-images
144144

145+
rm -rf ${RESULT_DIR}/samples
146+
145147
# now archive all the local test files
146148
$SCRIPTPATH/archive.sh "${RESULT_DIR}" "${RESULT_DIR}_archive"
147149

0 commit comments

Comments
 (0)