OpenShiftInternalRuntime extends KubernetesInternalRuntime<OpenShiftEnvironment> { @Override @Traced protected void startMachines() throws InfrastructureException { OpenShiftEnvironment osEnv = getContext().getEnvironment(); String workspaceId = getContext().getIdentity().getWorkspaceId(); createSecrets(osEnv, workspaceId); List<ConfigMap> createdConfigMaps = createConfigMaps(osEnv, getContext().getIdentity()); List<Service> createdServices = createServices(osEnv, workspaceId); List<Route> createdRoutes = createRoutes(osEnv, workspaceId); listenEvents(); doStartMachine(serverResolverFactory.create(createdServices, createdRoutes, createdConfigMaps)); } @Inject  OpenShiftInternalRuntime(
      @Named("che.infra.kubernetes.workspace_start_timeout_min") int workspaceStartTimeout,
      @Named("che.infra.kubernetes.ingress_start_timeout_min") int ingressStartTimeout,
      NoOpURLRewriter urlRewriter,
      UnrecoverablePodEventListenerFactory unrecoverablePodEventListenerFactory,
      ServersCheckerFactory serverCheckerFactory,
      WorkspaceVolumesStrategy volumesStrategy,
      ProbeScheduler probeScheduler,
      WorkspaceProbesFactory probesFactory,
      RuntimeEventsPublisher eventPublisher,
      KubernetesSharedPool sharedPool,
      KubernetesRuntimeStateCache runtimesStatusesCache,
      KubernetesMachineCache machinesCache,
      StartSynchronizerFactory startSynchronizerFactory,
      Set<InternalEnvironmentProvisioner> internalEnvironmentProvisioners,
      OpenShiftEnvironmentProvisioner kubernetesEnvironmentProvisioner,
      SidecarToolingProvisioner<OpenShiftEnvironment> toolingProvisioner,
      RuntimeHangingDetector runtimeHangingDetector,
      OpenShiftPreviewUrlCommandProvisioner previewUrlCommandProvisioner,
      SecretAsContainerResourceProvisioner<OpenShiftEnvironment>
          secretAsContainerResourceProvisioner,
      OpenShiftServerResolverFactory serverResolverFactory,
      RuntimeCleaner runtimeCleaner,
      CheNamespace cheNamespace,
      Tracer tracer,
      Openshift4TrustedCAProvisioner trustedCAProvisioner,
      @Assisted OpenShiftRuntimeContext context,
      @Assisted OpenShiftProject project);   }
@Test public void shouldStartMachines() throws Exception { final Container container1 = mockContainer(CONTAINER_NAME_1, EXPOSED_PORT_1); final Container container2 = mockContainer(CONTAINER_NAME_2, EXPOSED_PORT_2, INTERNAL_PORT); final ImmutableMap<String, Pod> allPods = ImmutableMap.of(POD_NAME, mockPod(ImmutableList.of(container1, container2))); when(osEnv.getPodsCopy()).thenReturn(allPods); when(unrecoverablePodEventListenerFactory.isConfigured()).thenReturn(true); internalRuntime.startMachines(); verify(deployments).deploy(any(Pod.class)); verify(routes).create(any()); verify(services).create(any()); verify(secrets).create(any()); verify(configMaps).create(any()); verify(project.deployments(), times(2)).watchEvents(any()); verify(eventService, times(2)).publish(any()); verifyEventsOrder(newEvent(M1_NAME, STARTING), newEvent(M2_NAME, STARTING)); }
@Test public void shouldStartMachinesWithoutUnrecoverableEventHandler() throws Exception { when(unrecoverablePodEventListenerFactory.isConfigured()).thenReturn(false); final Container container1 = mockContainer(CONTAINER_NAME_1, EXPOSED_PORT_1); final Container container2 = mockContainer(CONTAINER_NAME_2, EXPOSED_PORT_2, INTERNAL_PORT); final ImmutableMap<String, Pod> allPods = ImmutableMap.of(POD_NAME, mockPod(ImmutableList.of(container1, container2))); when(osEnv.getPodsCopy()).thenReturn(allPods); internalRuntime.startMachines(); verify(deployments).deploy(any(Pod.class)); verify(routes).create(any()); verify(services).create(any()); verify(project.deployments(), times(1)).watchEvents(any()); verify(eventService, times(2)).publish(any()); verifyEventsOrder(newEvent(M1_NAME, STARTING), newEvent(M2_NAME, STARTING)); }