Add a field to `RunRequest` to pass arbitrary messages to the `CommandServer`.
The server is already extensible by installing additional `BlazeModule` instances. This change allows the client to similarly enrich the request with message types that need not be known to all server flavors so long as there is a `BlazeModule` installed that can recognize the extension.
PiperOrigin-RevId: 349297854
diff --git a/src/test/java/com/google/devtools/build/lib/remote/RemoteModuleTest.java b/src/test/java/com/google/devtools/build/lib/remote/RemoteModuleTest.java
index 2071b67..1e0e40a 100644
--- a/src/test/java/com/google/devtools/build/lib/remote/RemoteModuleTest.java
+++ b/src/test/java/com/google/devtools/build/lib/remote/RemoteModuleTest.java
@@ -27,6 +27,7 @@
import build.bazel.remote.execution.v2.GetCapabilitiesRequest;
import build.bazel.remote.execution.v2.ServerCapabilities;
import com.google.auth.Credentials;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.eventbus.EventBus;
@@ -76,7 +77,7 @@
/** Tests for {@link RemoteModule}. */
@RunWith(JUnit4.class)
-public class RemoteModuleTest {
+public final class RemoteModuleTest {
private static CommandEnvironment createTestCommandEnvironment(RemoteOptions remoteOptions)
throws IOException, AbruptExitException {
@@ -127,7 +128,7 @@
productName);
BlazeWorkspace workspace = runtime.initWorkspace(directories, BinTools.empty(directories));
Command command = BuildCommand.class.getAnnotation(Command.class);
- return workspace.initCommand(command, options, new ArrayList<>(), 0, 0);
+ return workspace.initCommand(command, options, new ArrayList<>(), 0, 0, ImmutableList.of());
}
static class CapabilitiesImpl extends CapabilitiesImplBase {
@@ -147,7 +148,7 @@
responseObserver.onCompleted();
}
- public int getRequestCount() {
+ int getRequestCount() {
return requestCount;
}
}
@@ -371,11 +372,7 @@
CommandEnvironment env = createTestCommandEnvironment(remoteOptions);
- assertThrows(
- AbruptExitException.class,
- () -> {
- remoteModule.beforeCommand(env);
- });
+ assertThrows(AbruptExitException.class, () -> remoteModule.beforeCommand(env));
} finally {
cacheServer.shutdownNow();
cacheServer.awaitTermination();
@@ -408,11 +405,7 @@
CommandEnvironment env = createTestCommandEnvironment(remoteOptions);
- assertThrows(
- AbruptExitException.class,
- () -> {
- remoteModule.beforeCommand(env);
- });
+ assertThrows(AbruptExitException.class, () -> remoteModule.beforeCommand(env));
} finally {
cacheServer.shutdownNow();
cacheServer.awaitTermination();