Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] fix double bracket init #45460

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions java/test/src/main/java/io/ray/test/RuntimeEnvTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static io.ray.api.runtimeenv.types.RuntimeEnvName.JARS;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.ray.api.ActorHandle;
import io.ray.api.Ray;
import io.ray.api.runtimeenv.RuntimeEnv;
Expand Down Expand Up @@ -72,18 +73,12 @@ public void testEnvVarsForNormalTask() {
Ray.init();
RuntimeEnv runtimeEnv = new RuntimeEnv.Builder().build();
Map<String, String> envMap =
new HashMap<String, String>() {
{
put("KEY1", "A");
put("KEY2", "B");
put("KEY1", "C");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this thing has two "KEY1" ?

}
};
new HashMap<String, String>(ImmutableMap.of("KEY1", "A", "KEY2", "B", "KEY3", "C"));
runtimeEnv.set(RuntimeEnvName.ENV_VARS, envMap);

String val =
Ray.task(RuntimeEnvTest::getEnvVar, "KEY1").setRuntimeEnv(runtimeEnv).remote().get();
Assert.assertEquals(val, "C");
Assert.assertEquals(val, "A");
val = Ray.task(RuntimeEnvTest::getEnvVar, "KEY2").setRuntimeEnv(runtimeEnv).remote().get();
Assert.assertEquals(val, "B");
} finally {
Expand All @@ -97,12 +92,7 @@ public void testPerTaskEnvVarsOverwritePerJobEnvVars() {
System.setProperty("ray.job.runtime-env.env-vars.KEY2", "B");
try {
Ray.init();
Map<String, String> envMap =
new HashMap<String, String>() {
{
put("KEY1", "C");
}
};
Map<String, String> envMap = new HashMap<String, String>(ImmutableMap.of("KEY1", "C"));
RuntimeEnv runtimeEnv = new RuntimeEnv.Builder().build();
runtimeEnv.set(RuntimeEnvName.ENV_VARS, envMap);

Expand Down
Loading