Skip to content

Commit 9db7239

Browse files
committed
export JAVA_HOME and PATH before calling create-domain.sh
1 parent 5fefb54 commit 9db7239

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.Map;
1010
import java.util.Properties;
1111
import java.util.logging.FileHandler;
12+
import java.util.logging.Level;
1213
import java.util.logging.Logger;
1314
import java.util.logging.SimpleFormatter;
1415
import javax.jms.Connection;
@@ -585,23 +586,35 @@ private void callWebAppAndVerifyScaling(Domain domain, int replicas) throws Exce
585586
}
586587

587588
public static void tearDown() throws Exception {
589+
logger.log(
590+
Level.INFO,
591+
"TEARDOWN: Starting Test Run TearDown (cleanup and state-dump)."
592+
+ " Note that if the test failed previous to tearDown, "
593+
+ " the error that caused the test failure may be reported "
594+
+ "after the tearDown completes. Note that tearDown itself may report errors,"
595+
+ " but this won't affect the outcome of the test results.");
588596
StringBuffer cmd =
589597
new StringBuffer("export RESULT_ROOT=$RESULT_ROOT && export PV_ROOT=$PV_ROOT && ");
590598
cmd.append(BaseTest.getProjectRoot())
591599
.append("/integration-tests/src/test/resources/statedump.sh");
592600
logger.info("Running " + cmd);
593601

602+
// renew lease before callin statedump.sh
603+
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
604+
594605
ExecResult result = ExecCommand.exec(cmd.toString());
595606
if (result.exitValue() == 0) {
596-
logger.info("Executed statedump.sh " + result.stdout());
607+
// logger.info("Executed statedump.sh " + result.stdout());
597608
} else {
598609
logger.info("Execution of statedump.sh failed, " + result.stderr() + "\n" + result.stdout());
599610
}
600611

601-
// if (JENKINS) {
602-
result = cleanup();
603-
logger.info("cleanup result =" + result.stdout() + "\n " + result.stderr());
604-
// }
612+
if (JENKINS) {
613+
result = cleanup();
614+
if (result.exitValue() != 0) {
615+
logger.info("cleanup result =" + result.stdout() + "\n " + result.stderr());
616+
}
617+
}
605618

606619
if (getLeaseId() != "") {
607620
logger.info("Release the k8s cluster lease");

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,12 @@ private void callCreateDomainScript(String outputDir) throws Exception {
896896
StandardCopyOption.REPLACE_EXISTING);
897897
}
898898

899-
StringBuffer createDomainScriptCmd = new StringBuffer(BaseTest.getResultDir());
899+
StringBuffer createDomainScriptCmd = new StringBuffer("export JAVA_HOME=");
900+
901+
createDomainScriptCmd
902+
.append(System.getenv("JAVA_HOME"))
903+
.append(" && export PATH=$JAVA_HOME/bin:$PATH && ")
904+
.append(BaseTest.getResultDir());
900905

901906
// call different create-domain.sh based on the domain type
902907
if (domainMap.containsKey("domainHomeImageBase")) {

0 commit comments

Comments
 (0)