@Test(dependsOnMethods = "testListImages") public void testCreateContainer() throws IOException, InterruptedException { Config containerConfig = Config.builder() .imageId(image.getId()) .cmd( ImmutableList.of("/bin/sh", "-c", "while true; do echo hello world; sleep 1; done")) .build(); container = api().createContainer("testCreateContainer", containerConfig); assertNotNull(container); assertNotNull(container.getId()); }
@Test(dependsOnMethods = "testStopContainer", expectedExceptions = NullPointerException.class) public void testRemoveContainer() { api().removeContainer(container.getId()); assertFalse(api().inspectContainer(container.getId()).getState().isRunning()); }
@Test(dependsOnMethods = "testStartContainer") public void testStopContainer() { api().stopContainer(container.getId()); assertFalse(api().inspectContainer(container.getId()).getState().isRunning()); }
@Test(dependsOnMethods = "testCreateContainer") public void testStartContainer() throws IOException, InterruptedException { api().startContainer(container.getId()); assertTrue(api().inspectContainer(container.getId()).getState().isRunning()); }