[Java] Some bug fixes about Java UT workflow (#14444)

This commit is contained in:
Kai Yang 2021-03-03 19:32:14 +08:00 committed by GitHub
parent c53c909130
commit d653394c7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View file

@ -98,18 +98,15 @@ RAY_BACKEND_LOG_LEVEL=debug java -cp bazel-bin/java/all_tests_deploy.jar -Dray.a
-Dray.redis.password='123456' -Dray.job.code-search-path="$PWD/bazel-bin/java/all_tests_deploy.jar" io.ray.test.MultiDriverTest
ray stop
# See issue #13742 the test is very flaky.
# Skipping the doc test for now.
# echo "Running documentation demo code."
# docdemo_path="java/test/src/main/java/io/ray/docdemo/"
# for file in "$docdemo_path"*.java; do
# file=${file#"$docdemo_path"}
# class=${file%".java"}
# echo "Running $class"
# java -cp bazel-bin/java/all_tests_deploy.jar "io.ray.docdemo.$class"
# done
# popd
echo "Running documentation demo code."
docdemo_path="java/test/src/main/java/io/ray/docdemo/"
for file in "$docdemo_path"*.java; do
file=${file#"$docdemo_path"}
class=${file%".java"}
echo "Running $class"
java -cp bazel-bin/java/all_tests_deploy.jar -Dray.job.num-java-workers-per-process=1 "io.ray.docdemo.$class"
done
popd
pushd "$ROOT_DIR"
echo "Testing maven install."

View file

@ -1,15 +1,20 @@
package io.ray.test;
import com.google.common.collect.ImmutableList;
import java.util.List;
import org.testng.IClassListener;
import org.testng.ITestClass;
public class SystemPropertyListener implements IClassListener {
private final List<String> whitelist = ImmutableList.of("ray.run-mode");
@Override
public void onAfterClass(ITestClass testClass) {
for (String key : System.getProperties().stringPropertyNames()) {
if (key.startsWith("ray.")) {
System.clearProperty(key);
if (!whitelist.stream().anyMatch(key::equals)) {
System.clearProperty(key);
}
}
}
}