aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2018-05-22 09:14:10 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-22 09:15:07 -0700
commitff559b4440fb36b63f3dd7ef0b2cf5517078069e (patch)
treeb3fe5ef18e9314a32b6df725db64826978808056 /src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java
parent06e43f8b56ca50d7b87c7963d2251d1c72c00977 (diff)
Remove special handling of SpawnActionContext in Executor/ActionExecContext
Instead, internally look up the correct context by mnemonic. This simplifies all the callers. We still need a little bit of special casing when constructing the action context map. PiperOrigin-RevId: 197572357
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java b/src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java
index 0f0a02363d..7c89da42ef 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java
@@ -19,6 +19,7 @@ import static com.google.devtools.build.lib.testutil.TestConstants.WORKSPACE_NAM
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.same;
import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableList;
@@ -135,7 +136,8 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
.build();
when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableList.of(expectedSpawnResult));
- when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext);
+ when(actionExecutionContext.getContext(same(SpawnActionContext.class)))
+ .thenReturn(spawnActionContext);
// actual StandaloneTestStrategy execution
List<SpawnResult> spawnResults =
@@ -221,7 +223,8 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
.thenThrow(new SpawnExecException("test failed", failSpawnResult, false))
.thenReturn(ImmutableList.of(passSpawnResult));
- when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext);
+ when(actionExecutionContext.getContext(same(SpawnActionContext.class)))
+ .thenReturn(spawnActionContext);
// actual StandaloneTestStrategy execution
List<SpawnResult> spawnResults =
@@ -306,7 +309,8 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
.build();
when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableList.of(expectedSpawnResult));
- when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext);
+ when(actionExecutionContext.getContext(same(SpawnActionContext.class)))
+ .thenReturn(spawnActionContext);
// actual StandaloneTestStrategy execution
List<SpawnResult> spawnResults =
@@ -383,7 +387,8 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
.build();
when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableList.of(expectedSpawnResult));
- when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext);
+ when(actionExecutionContext.getContext(same(SpawnActionContext.class)))
+ .thenReturn(spawnActionContext);
// actual StandaloneTestStrategy execution
List<SpawnResult> spawnResults =
@@ -485,7 +490,8 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
expectedSpawnResult,
/*forciblyRunRemotely=*/ false,
/*catastrophe=*/ false));
- when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext);
+ when(actionExecutionContext.getContext(same(SpawnActionContext.class)))
+ .thenReturn(spawnActionContext);
// actual StandaloneTestStrategy execution
List<SpawnResult> spawnResults =
@@ -563,7 +569,8 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
SpawnResult expectedSpawnResult =
new SpawnResult.Builder().setStatus(Status.SUCCESS).setRunnerName("test").build();
when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableList.of(expectedSpawnResult));
- when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext);
+ when(actionExecutionContext.getContext(same(SpawnActionContext.class)))
+ .thenReturn(spawnActionContext);
// actual StandaloneTestStrategy execution
List<SpawnResult> spawnResults =