KubernetesInternalRuntime extends InternalRuntime<KubernetesRuntimeContext<E>> { @Override public List<? extends Command> getCommands() throws InfrastructureException { return runtimeStates.getCommands(getContext().getIdentity()); } @Inject  KubernetesInternalRuntime(
      @Named("che.infra.kubernetes.workspace_start_timeout_min") int workspaceStartTimeoutMin,
      @Named("che.infra.kubernetes.ingress_start_timeout_min") int ingressStartTimeoutMin,
      NoOpURLRewriter urlRewriter,
      UnrecoverablePodEventListenerFactory unrecoverableEventListenerFactory,
      ServersCheckerFactory serverCheckerFactory,
      WorkspaceVolumesStrategy volumesStrategy,
      ProbeScheduler probeScheduler,
      WorkspaceProbesFactory probesFactory,
      RuntimeEventsPublisher eventPublisher,
      KubernetesSharedPool sharedPool,
      KubernetesRuntimeStateCache runtimeStates,
      KubernetesMachineCache machines,
      StartSynchronizerFactory startSynchronizerFactory,
      Set<InternalEnvironmentProvisioner> internalEnvironmentProvisioners,
      KubernetesEnvironmentProvisioner<E> kubernetesEnvironmentProvisioner,
      SidecarToolingProvisioner<E> toolingProvisioner,
      RuntimeHangingDetector runtimeHangingDetector,
      PreviewUrlCommandProvisioner previewUrlCommandProvisioner,
      SecretAsContainerResourceProvisioner secretAsContainerResourceProvisioner,
      KubernetesServerResolverFactory kubernetesServerResolverFactory,
      RuntimeCleaner runtimeCleaner,
      CheNamespace cheNamespace,
      Tracer tracer,
      @Assisted KubernetesRuntimeContext<E> context,
      @Assisted KubernetesNamespace namespace); void scheduleRuntimeStateChecks(); CompletableFuture<Void> waitRunningAsync(
      List<CompletableFuture<?>> toCancelFutures, KubernetesMachineImpl machine); @Override Map<String, ? extends KubernetesMachineImpl> getInternalMachines(); @Override List<? extends Command> getCommands(); @Override Map<String, String> getProperties(); @Override WorkspaceStatus getStatus(); void scheduleServersCheckers(); boolean isConsistent();  }
@Test public void shouldReturnCommandsAfterRuntimeStart() throws Exception { CommandImpl commandToProvision = new CommandImpl("provisioned-command", "build", "env"); doAnswer( (Answer<Void>) invocationOnMock -> { k8sEnv.getCommands().add(commandToProvision); return null; }) .when(internalEnvironmentProvisioner) .provision(any(), any()); internalRuntime.start(emptyMap()); List<? extends Command> commands = internalRuntime.getCommands(); assertEquals(commands.size(), 2); Optional<? extends Command> envCommandOpt = commands.stream().filter(c -> "envCommand".equals(c.getName())).findAny(); assertTrue(envCommandOpt.isPresent()); Command envCommand = envCommandOpt.get(); assertEquals(envCommand.getCommandLine(), envCommand.getCommandLine()); assertEquals(envCommand.getType(), envCommand.getType()); Optional<? extends Command> provisionedCommandOpt = commands.stream().filter(c -> "provisioned-command".equals(c.getName())).findAny(); assertTrue(provisionedCommandOpt.isPresent()); Command provisionedCommand = provisionedCommandOpt.get(); assertEquals(provisionedCommand.getCommandLine(), provisionedCommand.getCommandLine()); assertEquals(provisionedCommand.getType(), provisionedCommand.getType()); }