mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 12:10:40 +08:00
[Java] ID length fix (#6454)
This commit is contained in:
@@ -42,11 +42,11 @@ public class GcsClientTest extends BaseTest {
|
||||
public void testNextJob() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
RayConfig config = TestUtils.getRuntime().getRayConfig();
|
||||
// The value of job id of this driver in cluster should be `1L`.
|
||||
// The value of job id of this driver in cluster should be 1.
|
||||
Assert.assertEquals(config.getJobId(), JobId.fromInt(1));
|
||||
|
||||
GcsClient gcsClient = TestUtils.getRuntime().getGcsClient();
|
||||
for (int i = 2; i < 100; ++i) {
|
||||
for (int i = 2; i < 100; ++i) {
|
||||
Assert.assertEquals(gcsClient.nextJobId(), JobId.fromInt(i));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package org.ray.api.test;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.ray.api.Ray;
|
||||
import org.ray.api.RayActor;
|
||||
import org.ray.api.annotation.RayRemote;
|
||||
import org.ray.api.id.ActorId;
|
||||
import org.ray.api.id.JobId;
|
||||
import org.ray.api.id.UniqueId;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@@ -13,10 +14,17 @@ import org.testng.annotations.Test;
|
||||
|
||||
public class RuntimeContextTest extends BaseTest {
|
||||
|
||||
private static JobId JOB_ID = JobId.fromHexString("00112233");
|
||||
private static JobId JOB_ID = getJobId();
|
||||
private static String RAYLET_SOCKET_NAME = "/tmp/ray/test/raylet_socket";
|
||||
private static String OBJECT_STORE_SOCKET_NAME = "/tmp/ray/test/object_store_socket";
|
||||
|
||||
private static JobId getJobId() {
|
||||
// Must be stable across different processes.
|
||||
byte[] bytes = new byte[JobId.LENGTH];
|
||||
Arrays.fill(bytes, (byte) 127);
|
||||
return JobId.fromByteBuffer(ByteBuffer.wrap(bytes));
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public void setUp() {
|
||||
System.setProperty("ray.job.id", JOB_ID.toString());
|
||||
|
||||
Reference in New Issue
Block a user