Skip to content

Commit d84f799

Browse files
morotencopybara-github
authored andcommitted
Fix remote spawn tests for remote_merkle_tree_cache=true
When setting `--experimental_remote_merkle_tree_cache=true` as default and running the test suite, some errors became visible. This change fixes those errors. Closes bazelbuild#14300. PiperOrigin-RevId: 412274673
1 parent 748b996 commit d84f799

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnCacheTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public MetadataProvider getMetadataProvider() {
143143

144144
@Override
145145
public ArtifactExpander getArtifactExpander() {
146-
throw new UnsupportedOperationException();
146+
return SIMPLE_ARTIFACT_EXPANDER;
147147
}
148148

149149
@Override

src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerTest.java

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import com.google.devtools.build.lib.exec.RemoteLocalFallbackRegistry;
7575
import com.google.devtools.build.lib.exec.SpawnCheckingCacheEvent;
7676
import com.google.devtools.build.lib.exec.SpawnExecutingEvent;
77+
import com.google.devtools.build.lib.exec.SpawnInputExpander;
7778
import com.google.devtools.build.lib.exec.SpawnRunner;
7879
import com.google.devtools.build.lib.exec.SpawnRunner.SpawnExecutionContext;
7980
import com.google.devtools.build.lib.exec.SpawnSchedulingEvent;
@@ -1267,6 +1268,7 @@ public void shouldReportCheckingCacheBeforeScheduling() throws Exception {
12671268

12681269
Spawn spawn = newSimpleSpawn();
12691270
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
1271+
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
12701272
when(policy.getTimeout()).thenReturn(Duration.ZERO);
12711273

12721274
when(executor.executeRemotely(
@@ -1310,6 +1312,7 @@ public void shouldReportExecutingStatusWithoutMetadata() throws Exception {
13101312

13111313
Spawn spawn = newSimpleSpawn();
13121314
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
1315+
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
13131316
when(policy.getTimeout()).thenReturn(Duration.ZERO);
13141317

13151318
when(executor.executeRemotely(
@@ -1353,6 +1356,7 @@ public void shouldReportExecutingStatusAfterGotExecutingStageFromMetadata() thro
13531356

13541357
Spawn spawn = newSimpleSpawn();
13551358
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
1359+
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
13561360
when(policy.getTimeout()).thenReturn(Duration.ZERO);
13571361

13581362
when(executor.executeRemotely(
@@ -1413,6 +1417,7 @@ public void shouldIgnoreInvalidMetadata() throws Exception {
14131417

14141418
Spawn spawn = newSimpleSpawn();
14151419
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
1420+
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
14161421
when(policy.getTimeout()).thenReturn(Duration.ZERO);
14171422

14181423
when(executor.executeRemotely(
@@ -1461,6 +1466,7 @@ public void shouldReportExecutingStatusIfNoExecutingStatusFromMetadata() throws
14611466

14621467
Spawn spawn = newSimpleSpawn();
14631468
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
1469+
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
14641470
when(policy.getTimeout()).thenReturn(Duration.ZERO);
14651471

14661472
when(executor.executeRemotely(
@@ -1510,6 +1516,7 @@ public void shouldReportExecutingStatusEvenNoOperationFromServer() throws Except
15101516

15111517
Spawn spawn = newSimpleSpawn();
15121518
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
1519+
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
15131520
when(policy.getTimeout()).thenReturn(Duration.ZERO);
15141521

15151522
when(executor.executeRemotely(

0 commit comments

Comments
 (0)