KubernetesDockerRunner implements DockerRunner { @Override public void close() throws IOException { closeWatch(); closer.close(); } @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 shouldReconnectUponWatcherClose() { Mockito.reset(k8sClient); when(k8sClient.watchPods(any())).thenThrow(new KubernetesClientException("Forced failure")).thenReturn(podWatch); podWatcher.onClose(new KubernetesClientException("Forced failure")); executor.tick(2, TimeUnit.SECONDS); verify(podWatch, times(2)).close(); verify(k8sClient, times(2)).watchPods(any()); }