Skip to content

Commit

Permalink
[Java] Make Java test more stable (ray-project#26282)
Browse files Browse the repository at this point in the history
If compile Ray in debug mode,

* run `MetricsTest:: testAddHistogram` will crash with below error message:

```
BucketBoundaries::Explicit called with non-monotonic boundary list.
java: external/io_opencensus_cpp/opencensus/stats/internal/bucket_boundaries.cc:64: opencensus::stats::BucketBoundaries::Explicit(std::__debug::vector<double>)::<lambda()>: Assertion `false && "0"' failed.
```

*  run `NamespaceTest::testIsolationInTheSameNamespaces` can fail with great possibility with below error message:

```
java.util.NoSuchElementException: No value present
	at java.util.Optional.get(Optional.java:135)
	at io.ray.test.NamespaceTest.lambda$testIsolationInTheSameNamespaces$2(NamespaceTest.java:39)
	at io.ray.test.NamespaceTest.testIsolation(NamespaceTest.java:116)
	at io.ray.test.NamespaceTest.testIsolationInTheSameNamespaces(NamespaceTest.java:36)
```
  • Loading branch information
kfstorm committed Jul 5, 2022
1 parent b08a968 commit ba642dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion java/test/src/main/java/io/ray/test/MetricTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public void testAddHistogram() {
tags.put(new TagKey("histogram_tag"), "default");
List<Double> boundaries = new ArrayList<>();
boundaries.add(10.0);
boundaries.add(15.0);
boundaries.add(12.0);
boundaries.add(15.0);
Histogram histogram = new Histogram("metric_histogram", "histogram", "1pc", boundaries, tags);
for (int i = 1; i <= 200; ++i) {
histogram.update(i * 1.0d);
Expand Down
1 change: 1 addition & 0 deletions java/test/src/main/java/io/ray/test/NamespaceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private static void testIsolation(Class<?> driverClass, Runnable runnable)
ProcessBuilder builder = TestUtils.buildDriver(driverClass, null);
builder.redirectError(ProcessBuilder.Redirect.INHERIT);
driver = builder.start();
TestUtils.waitForCondition(() -> Ray.getActor("a", "test1").isPresent(), 10000);
// Wait for driver to start.
driver.waitFor(10, TimeUnit.SECONDS);
runnable.run();
Expand Down

0 comments on commit ba642dd

Please sign in to comment.