Skip to content

Commit

Permalink
Fix remote spawn tests for remote_merkle_tree_cache=true (bazelbuild#…
Browse files Browse the repository at this point in the history
…14334)

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

Co-authored-by: Fredrik Medley <fredrik.medley@gmail.com>
  • Loading branch information
coeuvre and moroten authored Nov 25, 2021
1 parent fabdff4 commit 541ed05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public MetadataProvider getMetadataProvider() {

@Override
public ArtifactExpander getArtifactExpander() {
throw new UnsupportedOperationException();
return SIMPLE_ARTIFACT_EXPANDER;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import com.google.devtools.build.lib.exec.RemoteLocalFallbackRegistry;
import com.google.devtools.build.lib.exec.SpawnCheckingCacheEvent;
import com.google.devtools.build.lib.exec.SpawnExecutingEvent;
import com.google.devtools.build.lib.exec.SpawnInputExpander;
import com.google.devtools.build.lib.exec.SpawnRunner;
import com.google.devtools.build.lib.exec.SpawnRunner.SpawnExecutionContext;
import com.google.devtools.build.lib.exec.SpawnSchedulingEvent;
Expand Down Expand Up @@ -1267,6 +1268,7 @@ public void shouldReportCheckingCacheBeforeScheduling() throws Exception {

Spawn spawn = newSimpleSpawn();
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
when(policy.getTimeout()).thenReturn(Duration.ZERO);

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

Spawn spawn = newSimpleSpawn();
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
when(policy.getTimeout()).thenReturn(Duration.ZERO);

when(executor.executeRemotely(
Expand Down Expand Up @@ -1353,6 +1356,7 @@ public void shouldReportExecutingStatusAfterGotExecutingStageFromMetadata() thro

Spawn spawn = newSimpleSpawn();
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
when(policy.getTimeout()).thenReturn(Duration.ZERO);

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

Spawn spawn = newSimpleSpawn();
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
when(policy.getTimeout()).thenReturn(Duration.ZERO);

when(executor.executeRemotely(
Expand Down Expand Up @@ -1461,6 +1466,7 @@ public void shouldReportExecutingStatusIfNoExecutingStatusFromMetadata() throws

Spawn spawn = newSimpleSpawn();
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
when(policy.getTimeout()).thenReturn(Duration.ZERO);

when(executor.executeRemotely(
Expand Down Expand Up @@ -1510,6 +1516,7 @@ public void shouldReportExecutingStatusEvenNoOperationFromServer() throws Except

Spawn spawn = newSimpleSpawn();
SpawnExecutionContext policy = mock(SpawnExecutionContext.class);
when(policy.getSpawnInputExpander()).thenReturn(mock(SpawnInputExpander.class));
when(policy.getTimeout()).thenReturn(Duration.ZERO);

when(executor.executeRemotely(
Expand Down

0 comments on commit 541ed05

Please sign in to comment.