KubernetesDockerRunner implements DockerRunner { @VisibleForTesting boolean shouldDeletePod(WorkflowInstance workflowInstance, Pod pod, String reason) { final String name = pod.getMetadata().getName(); if (!debug.get()) { LOG.info("Deleting {} pod: {}, reason: '{}'", workflowInstance, name, reason); return true; } else { LOG.info("Keeping {} pod: {}, reason: '{}'", workflowInstance, name, reason); return false; } } @VisibleForTesting  KubernetesDockerRunner(String id, Fabric8KubernetesClient client, StateManager stateManager, Stats stats,
                         KubernetesGCPServiceAccountSecretManager serviceAccountSecretManager,
                         Debug debug, String styxEnvironment,
                         Set<String> secretWhitelist,
                         int cleanupPodsIntervalSeconds,
                         int podDeletionDelaySeconds,
                         Time time, ScheduledExecutorService scheduledExecutor);   KubernetesDockerRunner(String id, Fabric8KubernetesClient client, StateManager stateManager, Stats stats,
                         KubernetesGCPServiceAccountSecretManager serviceAccountSecretManager,
                         Debug debug, String styxEnvironment, Set<String> secretWhitelist); @Override String start(RunState runState, RunSpec runSpec); @Override void poll(RunState runState); @Override void cleanup(); @Override void close();  }
@Test public void shouldNotDeletePodIfDebugEnabled() { when(debug.get()).thenReturn(true); when(k8sClient.getPod(anyString())).thenReturn(Optional.of(createdPod)); var shouldDelete = kdr.shouldDeletePod(WORKFLOW_INSTANCE, createdPod, "Foobar!"); assertThat(shouldDelete, is(false)); }