@@ -212,83 +212,6 @@ public void exec_localOnlySpawn_runsLocalPostProcessingSpawn() throws Exception
212212 .inOrder ();
213213 }
214214
215- @ Test
216- public void exec_localOnlySpawn_noneCanExec_fails () throws Exception {
217- Spawn spawn =
218- new SpawnBuilder ().withMnemonic ("ThisMnemonic1" ).withOwnerPrimaryOutput (output1 ).build ();
219- Spawn postProcessingSpawn =
220- new SpawnBuilder ().withMnemonic ("ThatMnemonic2" ).withOwnerPrimaryOutput (output2 ).build ();
221-
222- DynamicSpawnStrategy dynamicSpawnStrategy =
223- createDynamicSpawnStrategy (
224- ExecutionPolicy .LOCAL_EXECUTION_ONLY , mockGetPostProcessingSpawn );
225- when (mockGetPostProcessingSpawn .apply (spawn )).thenReturn (Optional .of (postProcessingSpawn ));
226- SandboxedSpawnStrategy local = createMockSpawnStrategy (false );
227- SandboxedSpawnStrategy remote = createMockSpawnStrategy ();
228- ActionExecutionContext actionExecutionContext = createMockActionExecutionContext (local , remote );
229-
230- UserExecException thrown =
231- assertThrows (
232- UserExecException .class ,
233- () -> dynamicSpawnStrategy .exec (spawn , actionExecutionContext ));
234- assertThat (thrown )
235- .hasMessageThat ()
236- .isEqualTo (
237- "Spawn is not executable in local: No usable dynamic_local_strategy found (and remote"
238- + " execution disabled) for action ThisMnemonic1. Post-Processing Spawn is not"
239- + " executable in local: No usable dynamic_local_strategy found (and remote"
240- + " execution disabled) for action ThatMnemonic2. " );
241- assertThat (thrown ).hasMessageThat ().doesNotContain ("dynamic_remote_strategy" );
242- verifyNoInteractions (remote );
243- }
244-
245- @ Test
246- public void exec_localOnlySpawnWithNonExecutablePostProcessingSpawn_doesNotExecLocalSpawn ()
247- throws Exception {
248- Spawn spawn =
249- new SpawnBuilder ().withMnemonic ("ThisMnemonic1" ).withOwnerPrimaryOutput (output1 ).build ();
250- Spawn postProcessingSpawn =
251- new SpawnBuilder ().withMnemonic ("ThatMnemonic2" ).withOwnerPrimaryOutput (output2 ).build ();
252-
253- DynamicSpawnStrategy dynamicSpawnStrategy =
254- createDynamicSpawnStrategy (
255- ExecutionPolicy .LOCAL_EXECUTION_ONLY , mockGetPostProcessingSpawn );
256- when (mockGetPostProcessingSpawn .apply (spawn )).thenReturn (Optional .of (postProcessingSpawn ));
257-
258- SandboxedSpawnStrategy local = createMockSpawnStrategy ();
259-
260- ActionExecutionContext actionExecutionContext = mock (ActionExecutionContext .class );
261- when (actionExecutionContext .getFileOutErr ()).thenReturn (new TestFileOutErr ());
262- when (actionExecutionContext .getContext (DynamicStrategyRegistry .class ))
263- .thenReturn (
264- new DynamicStrategyRegistry () {
265- @ Override
266- public ImmutableList <SandboxedSpawnStrategy > getDynamicSpawnActionContexts (
267- Spawn spawn , DynamicMode dynamicMode ) {
268- if (spawn .getMnemonic ().equals ("ThisMnemonic1" )) {
269- return ImmutableList .of (local );
270- }
271- return ImmutableList .of ();
272- }
273-
274- @ Override
275- public void notifyUsedDynamic (ActionContextRegistry actionContextRegistry ) {}
276- });
277- when (actionExecutionContext .withFileOutErr (any ())).thenReturn (actionExecutionContext );
278-
279- UserExecException thrown =
280- assertThrows (
281- UserExecException .class ,
282- () -> dynamicSpawnStrategy .exec (spawn , actionExecutionContext ));
283-
284- assertThat (thrown )
285- .hasMessageThat ()
286- .isEqualTo (
287- "Post-Processing Spawn is not executable in local: No usable dynamic_local_strategy"
288- + " found (and remote execution disabled) for action ThatMnemonic2. " );
289- assertThat (thrown ).hasMessageThat ().doesNotContain ("dynamic_remote_strategy" );
290- }
291-
292215 @ Test
293216 public void exec_failedLocalSpawn_doesNotExecLocalPostProcessingSpawn () throws Exception {
294217 testExecFailedLocalSpawnDoesNotExecLocalPostProcessingSpawn (
@@ -333,7 +256,6 @@ private void testExecFailedLocalSpawnDoesNotExecLocalPostProcessingSpawn(SpawnRe
333256 assertThat (results ).containsExactly (failedResult );
334257 assertThat (localSpawnCaptor .getAllValues ()).containsExactly (spawn );
335258 verify (remote , never ()).exec (any (), any (), any ());
336- verifyNoInteractions (postProcessingSpawn );
337259 }
338260
339261 @ Test
@@ -638,7 +560,6 @@ public void exec_runAnywhereSpawn_localCantExec_runsRemote() throws Exception {
638560 assertThat (results ).containsExactly (SUCCESSFUL_SPAWN_RESULT );
639561 // Never runs anything as it says it can't execute anything at all.
640562 verify (local , never ()).exec (any (), any (), any ());
641- verifyNoInteractions (postProcessingSpawn );
642563 }
643564
644565 @ Test
@@ -672,33 +593,6 @@ public void exec_runAnywhereSpawn_remoteCantExec_runsLocal() throws Exception {
672593 verify (remote , never ()).exec (any (), any (), any ());
673594 }
674595
675- @ Test
676- public void exec_runAnywhereSpawn_noneCanExec_fails () throws Exception {
677- Spawn spawn =
678- new SpawnBuilder ().withMnemonic ("ThisMnemonic1" ).withOwnerPrimaryOutput (output1 ).build ();
679- Spawn postProcessingSpawn =
680- new SpawnBuilder ().withMnemonic ("ThatMnemonic2" ).withOwnerPrimaryOutput (output2 ).build ();
681-
682- DynamicSpawnStrategy dynamicSpawnStrategy =
683- createDynamicSpawnStrategy (ExecutionPolicy .ANYWHERE , mockGetPostProcessingSpawn );
684- when (mockGetPostProcessingSpawn .apply (spawn )).thenReturn (Optional .of (postProcessingSpawn ));
685- SandboxedSpawnStrategy local = createMockSpawnStrategy (false );
686- SandboxedSpawnStrategy remote = createMockSpawnStrategy (false );
687- ActionExecutionContext actionExecutionContext = createMockActionExecutionContext (local , remote );
688-
689- UserExecException thrown =
690- assertThrows (
691- UserExecException .class ,
692- () -> dynamicSpawnStrategy .exec (spawn , actionExecutionContext ));
693- assertThat (thrown )
694- .hasMessageThat ()
695- .isEqualTo (
696- "Spawn is not executable in local: No usable dynamic_local_strategy or"
697- + " dynamic_remote_strategy found for action ThisMnemonic1. Post-Processing Spawn"
698- + " is not executable in local: No usable dynamic_local_strategy or"
699- + " dynamic_remote_strategy found for action ThatMnemonic2. " );
700- }
701-
702596 private DynamicSpawnStrategy createDynamicSpawnStrategy (
703597 ExecutionPolicy executionPolicy ,
704598 Function <Spawn , Optional <Spawn >> getPostProcessingSpawnForLocalExecution ) {
0 commit comments