Skip to content

Commit

Permalink
JDK11 support
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm authored and adejanovski committed Dec 10, 2021
1 parent a6d1724 commit e9cfc20
Show file tree
Hide file tree
Showing 11 changed files with 191 additions and 180 deletions.
24 changes: 22 additions & 2 deletions .github/scripts/configure-ccm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ echo "Starting Install step..."

set -xe

function set_java_home() {
major_version=$1
if [[ "$major_version" == "11" ]]; then
export CASSANDRA_USE_JDK11=true
else
export CASSANDRA_USE_JDK11=false
fi
for jdk in /opt/hostedtoolcache/Java_Adopt_jdk/${major_version}*/;
do
export JAVA_HOME="${jdk/}"x64/
echo "JAVA_HOME is set to $JAVA_HOME"
done
}

configure_ccm () {
sed -i 's/#MAX_HEAP_SIZE="4G"/MAX_HEAP_SIZE="256m"/' ~/.ccm/test/node$1/conf/cassandra-env.sh
sed -i 's/#HEAP_NEWSIZE="800M"/HEAP_NEWSIZE="200M"/' ~/.ccm/test/node$1/conf/cassandra-env.sh
Expand Down Expand Up @@ -45,6 +59,8 @@ configure_ccm () {
echo "JVM_OPTS=\"\$JVM_OPTS -Djava.rmi.server.hostname=127.0.0.$i\"" >> ~/.ccm/test/node$1/conf/cassandra-env.sh
}

set_java_home ${JDK_VERSION}

case "${TEST_TYPE}" in
"")
echo "ERROR: Environment variable TEST_TYPE is unspecified."
Expand All @@ -54,8 +70,12 @@ case "${TEST_TYPE}" in
mkdir -p ~/.local
cp ./.github/files/jmxremote.password ~/.local/jmxremote.password
chmod 400 ~/.local/jmxremote.password
sudo chmod 777 /opt/hostedtoolcache/Java_Adopt_jdk/8.0.192-12/x64/jre/lib/management/jmxremote.access
echo "cassandra readwrite" >> /opt/hostedtoolcache/Java_Adopt_jdk/8.0.192-12/x64/jre/lib/management/jmxremote.access
# Our move to support jdk11 makes it possible to get either jdk 8.0.192 or jdk 8.0.292 which both require to be configured properly.
for jdk in /opt/hostedtoolcache/Java_Adopt_jdk/8*/;
do
sudo chmod 777 "${jdk/}"x64/jre/lib/management/jmxremote.access
echo "cassandra readwrite" >> "${jdk/}"x64/jre/lib/management/jmxremote.access
done
if [[ ! -z $ELASSANDRA_VERSION ]]; then
ccm create test -v file:elassandra-${ELASSANDRA_VERSION}.tar.gz
else
Expand Down
25 changes: 22 additions & 3 deletions .github/scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ REAPER_ENCRYPTION_KEY="SECRET_KEY"

set -xe

function set_java_home() {
major_version=$1
for jdk in /opt/hostedtoolcache/Java_Adopt_jdk/${major_version}*/;
do
export JAVA_HOME="${jdk/}"x64/
echo "JAVA_HOME is set to $JAVA_HOME"
done
}

case "${TEST_TYPE}" in
"")
echo "ERROR: Environment variable TEST_TYPE is unspecified."
Expand All @@ -40,10 +49,14 @@ case "${TEST_TYPE}" in
"ccm"|"elassandra")
mvn --version -B
ps uax | grep cass
# dependending on the version of cassandra, we may need to use a different jdk
set_java_home ${JDK_VERSION}
ccm start -v --no-wait --skip-wait-other-notice || true
echo "${TEST_TYPE}" | grep -q ccm && sleep 30 || sleep 120
ccm status
ccm node1 nodetool -- -u cassandra -pw cassandrapassword status
# Reaper requires JDK11 for compilation
set_java_home 11
case "${STORAGE_TYPE}" in
"")
echo "ERROR: Environment variable STORAGE_TYPE is unspecified."
Expand All @@ -68,10 +81,12 @@ case "${TEST_TYPE}" in
"sidecar")
mvn --version -B
mvn -B package -DskipTests
# dependending on the version of cassandra, we may need to use a different jdk
set_java_home ${JDK_VERSION}
ccm start -v --no-wait --skip-wait-other-notice || true
sleep 30
ccm status

set_java_home 11
case "${STORAGE_TYPE}" in
"")
echo "ERROR: Environment variable STORAGE_TYPE is unspecified."
Expand All @@ -90,10 +105,12 @@ case "${TEST_TYPE}" in
"each")
mvn --version -B
mvn -B package -DskipTests
# dependending on the version of cassandra, we may need to use a different jdk
set_java_home ${JDK_VERSION}
ccm start -v --no-wait --skip-wait-other-notice || true
sleep 30
ccm status

set_java_home 11
case "${STORAGE_TYPE}" in
"")
echo "ERROR: Environment variable STORAGE_TYPE is unspecified."
Expand All @@ -111,11 +128,13 @@ case "${TEST_TYPE}" in
;;
"upgrade")
mvn --version -B
# dependending on the version of cassandra, we may need to use a different jdk
set_java_home ${JDK_VERSION}
ccm start -v --no-wait --skip-wait-other-notice || true
sleep 30
ccm status

ccm node1 cqlsh -e "DROP KEYSPACE reaper_db" || true
set_java_home 11
mvn package -B -DskipTests -Pintegration-upgrade-tests
MAVEN_OPTS="-Xmx384m" mvn -B surefire:test -Dtest=ReaperCassandraIT
;;
Expand Down
Loading

0 comments on commit e9cfc20

Please sign in to comment.