Configure java version in nightly tests depending on branch
Change-Id: I3ebf88de79a6f3a6650c331947159b25c253a6e7
diff --git a/TestON/JenkinsFile/CommonJenkinsFile.groovy b/TestON/JenkinsFile/CommonJenkinsFile.groovy
index 3060f08..0c350e6 100644
--- a/TestON/JenkinsFile/CommonJenkinsFile.groovy
+++ b/TestON/JenkinsFile/CommonJenkinsFile.groovy
@@ -182,6 +182,21 @@
'''
}
+def configureJavaVersion(){
+ java_1_8_branches = [ "1.15" ]
+ return '''#!/bin/bash -l
+ ''' + ( java_1_8_branches.contains( branch ) ? '''SET_JAVA_VER=java-8-oracle''' : '''SET_JAVA_VER=java-1.11.0-openjdk-amd64''' ) +
+ '''
+ CELL_COUNT=$( env | egrep "OC[1-9]+" | wc -l )
+ for i in $(seq 1 $CELL_COUNT)
+ do
+ CELL_TO_SET=$( env | egrep "OC$i" | cut -c5- )
+ echo "Setting java to $SET_JAVA_VER on $CELL_TO_SET"
+ eval ssh $CELL_TO_SET 'sudo update-java-alternatives -s $SET_JAVA_VER'
+ done
+ '''
+}
+
def runTestCli_py( testName, pureTestName, testCategory ){
// Bash script that will run the test.
// testName : name of the test
@@ -373,6 +388,7 @@
// Remove the old database file
sh SCPFfuncs.cleanupDatabaseFile( testName )
}
+ sh script: configureJavaVersion(), label: "Configure Java Version"
sh script: initTest(), label: "Test Initialization: stc shutdown; stc teardown; ./cleanup.sh"
catchError{
sh script: runTestCli_py( testName, pureTestName, testCategory ), label: ( "Run Test: ./cli.py run " + testName )