private ContainerState buildContainer(MockDockerContainerToHostState containerToHostState) { ContainerState containerState = new ContainerState(); containerState.parentLink = containerToHostState.parentLink; containerState.id = containerToHostState.id; containerState.names = Arrays.asList(containerToHostState.name); containerState.image = containerToHostState.image; containerState.powerState = containerToHostState.powerState; return containerState; }
private ContainerState createContainer(List<String> tenantLink) { ContainerState containerState = new ContainerState(); containerState.id = UUID.randomUUID().toString(); containerState.name = UUID.randomUUID().toString(); containerState.parentLink = "Test"; containerState.tenantLinks = tenantLink; return containerState; }
private ContainerState createContainer(String compositeComponentLink) throws Throwable { ContainerState containerState = new ContainerState(); containerState.id = UUID.randomUUID().toString(); containerState.names = new ArrayList<>(Arrays.asList("name_" + containerState.id)); containerState.compositeComponentLink = compositeComponentLink; containerState = doPost(containerState, ContainerFactoryService.SELF_LINK); return containerState; }
private ContainerState createContainerStateAsUser(String projectName, String userEmail) throws Throwable { String projectLink = getProjectLinkByName(projectName); String userLink = buildUserServicePath(userEmail); host.assumeIdentity(userLink); ContainerState cs = new ContainerState(); cs.name = UUID.randomUUID().toString(); cs.descriptionLink = "desc-link"; cs.tenantLinks = new ArrayList<>(); cs.tenantLinks.add(projectLink); ContainerState result = doPost(cs, ContainerFactoryService.SELF_LINK); host.assumeIdentity(buildUserServicePath(USER_EMAIL_ADMIN2)); return result; }
protected void createHostShellContainer() throws Throwable { waitForServiceAvailability(ContainerFactoryService.SELF_LINK); ContainerState state = new ContainerState(); String hostId = Service.getId(dockerHostState.documentSelfLink); state.documentSelfLink = SystemContainerDescriptions.getSystemContainerSelfLink( SystemContainerDescriptions.AGENT_CONTAINER_NAME, hostId); state.parentLink = dockerHostState.documentSelfLink; PortBinding portBinding = new PortBinding(); portBinding.containerPort = "80"; portBinding.hostPort = "80"; state.ports = new ArrayList<>(); state.ports.add(portBinding); shellContainerState = doPost(state, ContainerFactoryService.SELF_LINK); }
@Before public void setUp() throws Throwable { waitForServiceAvailability(LogService.FACTORY_LINK); waitForServiceAvailability(ContainerFactoryService.SELF_LINK); waitForServiceAvailability(ContainerLogService.SELF_LINK); container = new ContainerState(); container.id = UUID.randomUUID().toString(); container.names = new ArrayList<>(Arrays.asList("test-name")); container = doPost(container, ContainerFactoryService.SELF_LINK); logState = new LogServiceState(); logState.logs = TEST_LOG_CONTENT.getBytes(); logState.documentSelfLink = extractId(container.documentSelfLink); }
@Test public void testPatchUnhealthyContainerState() { // When the health check fails for a given container, its power state is marked as 'ERROR' // and its status as 'unhealthy'. See ContainerHealthEvaluator.patchContainerStatus. predefinedState.powerState = PowerState.ERROR; predefinedState.status = ContainerState.CONTAINER_UNHEALTHY_STATUS; ContainerState mappedState = new ContainerState(); mappedState.powerState = predefinedState.powerState; mappedState.status = predefinedState.status; ContainerStateMapper.propertiesToContainerState(mappedState, predefinedInspectMap); assertEquals(PowerState.ERROR, mappedState.powerState); assertEquals(ContainerState.CONTAINER_UNHEALTHY_STATUS, mappedState.status); }
private ContainerState createContainer(ContainerDescription desc, String hostLink) throws Throwable { ContainerState container = new ContainerState(); container.descriptionLink = desc.documentSelfLink; container.id = UUID.randomUUID().toString(); container.parentLink = hostLink; container.compositeComponentLink = UriUtils.buildUriPath( CompositeComponentFactoryService.SELF_LINK, contextId); container = doPost(container, ContainerFactoryService.SELF_LINK); assertNotNull(container); addForDeletion(container); return container; }
@Test public void testMissingContainer() throws Throwable { ContainerState cs = new ContainerState(); cs.id = UUID.randomUUID().toString(); cs.names = new ArrayList<>(Collections.singletonList("name_" + cs.id)); cs.parentLink = COMPUTE_HOST_LINK; cs.powerState = ContainerState.PowerState.RUNNING; cs = doPost(cs, ContainerFactoryService.SELF_LINK); // run data collection on preexisting system container with old version startAndWaitHostContainerListDataCollection(); cs = getDocument(ContainerState.class, cs.documentSelfLink); assertEquals(PowerState.RETIRED, cs.powerState); }
private ContainerState createContainerState(String containerDescriptionLink) { ContainerState container = new ContainerState(); container.descriptionLink = containerDescriptionLink; container.adapterManagementReference = UriUtils.buildUri(ManagementUriParts.ADAPTER_DOCKER); container.status = ContainerState.CONTAINER_RUNNING_STATUS; return container; }
@Test public void testCreateContainerServiceIntercept() { ContainerState state = new ContainerState(); state.name = "test"; state.image = "test"; ContainerState doc = doPostWithProjectHeader(state, ContainerFactoryService.SELF_LINK, project.documentSelfLink, ContainerState.class); assertTenantLinks(doc, project.documentSelfLink); assertEquals(state.name, doc.name); assertEquals(state.image, doc.image); }
private ContainerState createContainerState(String containerDescriptionLink, String parentLink) { ContainerState container = new ContainerState(); container.descriptionLink = containerDescriptionLink; container.parentLink = parentLink; container.status = ContainerState.CONTAINER_RUNNING_STATUS; container.adapterManagementReference = URI .create("http://remote-host:8082/docker-executor"); return container; }
private ContainerState createContainer(String parentLink) { ContainerState containerState = new ContainerState(); containerState.id = UUID.randomUUID().toString(); containerState.parentLink = parentLink; containerState.powerState = PowerState.STOPPED; containerState.system = Boolean.TRUE; return containerState; }
private ContainerState buildContainer(MockDockerContainerToHostState containerToHostState) { ContainerState containerState = new ContainerState(); containerState.parentLink = containerToHostState.parentLink; containerState.id = containerToHostState.id; containerState.name = containerToHostState.name; containerState.image = containerToHostState.image; containerState.powerState = containerToHostState.powerState; return containerState; } }
private ContainerState createContainerState(String descriptionLink) throws Throwable { ContainerState state = new ContainerState(); state.name = "test-container-state"; state.descriptionLink = descriptionLink; waitForServiceAvailability(ContainerFactoryService.SELF_LINK); ContainerState result = getOrCreateDocument(state, ContainerFactoryService.SELF_LINK); stateLinks.add(result.documentSelfLink); return result; }
public static ContainerState createContainer() { ContainerState cont = new ContainerState(); cont.parentLink = UriUtils.buildUriPath(ComputeService.FACTORY_LINK, DOCKER_COMPUTE_ID); cont.descriptionLink = UUID.randomUUID().toString(); cont.address = COMPUTE_ADDRESS; cont.powerState = com.vmware.admiral.compute.container.ContainerService.ContainerState.PowerState.RUNNING; cont.customProperties = new HashMap<>(); return cont; }
@Test public void TestMapContainerWithNullInputContainer() { ContainerState outState = new ContainerState(); ContainerStatus status = new ContainerStatus(); status.containerID = "docker://test-id"; // status.state = new ContainerState(); KubernetesContainerStateMapper.mapContainer(outState, null, status); Assert.assertNull(outState.id); Assert.assertNull(outState.powerState); }
public static ContainerState createContainerState() { ContainerState cs = new ContainerState(); cs.id = "testId"; cs.address = "testAddresss"; return cs; }
private ContainerState createContainerState(String name, String descriptionLink) throws Throwable { ContainerState state = new ContainerState(); state.name = randomName(name); state.descriptionLink = descriptionLink; waitForServiceAvailability(ContainerFactoryService.SELF_LINK); return getOrCreateDocument(state, ContainerFactoryService.SELF_LINK); }
@Before public void setUp() throws Throwable { waitForServiceAvailability(ContainerDescriptionService.FACTORY_LINK); waitForServiceAvailability(CompositeDescriptionFactoryService.SELF_LINK); waitForServiceAvailability(ContainerFactoryService.SELF_LINK); containerState = new ContainerState(); containerState.image = "test-image"; containerState = doPost(containerState, ContainerFactoryService.SELF_LINK); containerStats = new ContainerStats(); }