Don't eagerly compute local resources usage: when running an action remotely, it's mostly waste.

It's not completely wasted because in most cases we're going to iterate over the same nested set during action execution and so the next iteration will be memoized, but better to do one less iteration!

PiperOrigin-RevId: 425476278
diff --git a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
index 2452e18..abf0586 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
@@ -35,7 +35,6 @@
 import com.google.devtools.build.lib.actions.ExecException;
 import com.google.devtools.build.lib.actions.ExecutionRequirements;
 import com.google.devtools.build.lib.actions.FileArtifactValue;
-import com.google.devtools.build.lib.actions.ResourceSet;
 import com.google.devtools.build.lib.actions.SimpleSpawn;
 import com.google.devtools.build.lib.actions.Spawn;
 import com.google.devtools.build.lib.actions.SpawnContinuation;
@@ -132,11 +131,12 @@
       executionInfo.put(ExecutionRequirements.SUPPORTS_WORKERS, "1");
     }
 
-    ResourceSet localResourceUsage =
-        action
-            .getTestProperties()
-            .getLocalResourceUsage(
-                action.getOwner().getLabel(), executionOptions.usingLocalTestJobs());
+    SimpleSpawn.LocalResourcesSupplier localResourcesSupplier =
+        () ->
+            action
+                .getTestProperties()
+                .getLocalResourceUsage(
+                    action.getOwner().getLabel(), executionOptions.usingLocalTestJobs());
 
     Spawn spawn =
         new SimpleSpawn(
@@ -151,7 +151,7 @@
                 ? action.getTools()
                 : NestedSetBuilder.emptySet(Order.STABLE_ORDER),
             createSpawnOutputs(action),
-            localResourceUsage);
+            localResourcesSupplier);
     Path execRoot = actionExecutionContext.getExecRoot();
     ArtifactPathResolver pathResolver = actionExecutionContext.getPathResolver();
     Path runfilesDir = pathResolver.convertPath(action.getExecutionSettings().getRunfilesDir());