diff --git a/swh/storage/tests/test_cassandra.py b/swh/storage/tests/test_cassandra.py --- a/swh/storage/tests/test_cassandra.py +++ b/swh/storage/tests/test_cassandra.py @@ -102,6 +102,14 @@ stdout = stderr = subprocess.DEVNULL cassandra_bin = os.environ.get("SWH_CASSANDRA_BIN", "/usr/sbin/cassandra") + env = { + "MAX_HEAP_SIZE": "300M", + "HEAP_NEWSIZE": "50M", + "JVM_OPTS": "-Xlog:gc=error:file=%s/gc.log" % cassandra_log, + } + if "JAVA_HOME" in os.environ: + env["JAVA_HOME"] = os.environ["JAVA_HOME"] + proc = subprocess.Popen( [ cassandra_bin, @@ -111,11 +119,7 @@ "-Dcassandra-foreground=yes", ], start_new_session=True, - env={ - "MAX_HEAP_SIZE": "300M", - "HEAP_NEWSIZE": "50M", - "JVM_OPTS": "-Xlog:gc=error:file=%s/gc.log" % cassandra_log, - }, + env=env, stdout=stdout, stderr=stderr, )