use of org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition in project linuxtools by eclipse.
the class LabelsTest method testLabels.
@Test
public void testLabels() {
DockerImagesTab imagesTab = openDockerImagesTab();
imagesTab.runImage(IMAGE_NAME + ":" + IMAGE_TAG);
ImageRunSelectionPage firstPage = new ImageRunSelectionPage(imagesTab);
firstPage.setContainerName(CONTAINER_NAME);
firstPage.setAllocatePseudoTTY();
firstPage.setKeepSTDINOpen();
firstPage.setGiveExtendedPrivileges();
firstPage.next();
ImageRunResourceVolumesVariablesPage secondPage = new ImageRunResourceVolumesVariablesPage(firstPage);
secondPage.addLabel(CONTAINER_LABEL_KEY, CONTAINER_LABEL_VALUE);
secondPage.finish();
new WaitWhile(new JobIsRunning());
if (mockitoIsUsed()) {
// MockDockerClientFactory.addContainer(this.client, this.createdContainer, this.containerInfo);
runContainer();
getConnection().refresh();
new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
}
DockerContainersTab containerTab = new DockerContainersTab();
containerTab.searchContainer(CONTAINER_NAME);
containerTab.select(CONTAINER_NAME);
PropertySheet propertiesView = new PropertySheet();
propertiesView.open();
getConnection().getContainer(CONTAINER_NAME).select();
propertiesView.selectTab("Inspect");
String labelProp = propertiesView.getProperty("Config", "Labels", CONTAINER_LABEL_KEY).getPropertyValue();
assertTrue("Container does not have label " + CONTAINER_LABEL_KEY + "!", labelProp.equals(CONTAINER_LABEL_VALUE));
}
use of org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition in project linuxtools by eclipse.
the class LinkContainersTest method runUhttpServer.
public void runUhttpServer(String imageName, String containerName) {
DockerImagesTab imagesTab = openDockerImagesTab();
imagesTab.runImage(imageName);
ImageRunSelectionPage firstPage = openImageRunSelectionPage(containerName, false, imagesTab);
firstPage.setContainerName(containerName);
firstPage.setPublishAllExposedPorts(false);
firstPage.finish();
if (mockitoIsUsed()) {
mockServerContainer();
new WaitUntil(new ContainerIsDeployedCondition(containerName, getConnection()));
} else {
new WaitWhile(new JobIsRunning());
new WaitWhile(new ConsoleHasNoChange());
}
}
use of org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition in project linuxtools by eclipse.
the class PrivilegedModeTest method testPrivilegedMode.
@Test
public void testPrivilegedMode() {
DockerImagesTab imagesTab = openDockerImagesTab();
imagesTab.runImage(IMAGE_NAME + ":" + IMAGE_TAG);
ImageRunSelectionPage firstPage = new ImageRunSelectionPage(imagesTab);
firstPage.setContainerName(CONTAINER_NAME);
firstPage.setAllocatePseudoTTY();
firstPage.setKeepSTDINOpen();
firstPage.setGiveExtendedPrivileges();
firstPage.finish();
if (mockitoIsUsed()) {
runPrivilegedContainer();
// MockDockerClientFactory.addContainer(this.client,
// this.createdContainer, this.containerInfo);
getConnection().refresh();
new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
}
new WaitWhile(new JobIsRunning());
PropertySheet propertiesView = openPropertiesTabForContainer("Inspect", CONTAINER_NAME);
String privilegedProp = propertiesView.getProperty("HostConfig", "Privileged").getPropertyValue();
assertTrue("Container is not running in privileged mode!", privilegedProp.equals("true"));
}
use of org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition in project linuxtools by eclipse.
the class VolumeMountTest method testVolumeMount.
@Test
public void testVolumeMount() throws IOException {
DockerImagesTab imagesTab = openDockerImagesTab();
imagesTab.runImage(IMAGE_UHTTPD + ":" + IMAGE_TAG_LATEST);
ImageRunSelectionPage firstPage = new ImageRunSelectionPage(imagesTab);
firstPage.setContainerName(CONTAINER_NAME);
firstPage.setPublishAllExposedPorts(true);
firstPage.next();
ImageRunResourceVolumesVariablesPage secondPage = new ImageRunResourceVolumesVariablesPage(firstPage);
String volumePath = (new File(VOLUME_PATH)).getCanonicalPath();
secondPage.addDataVolumeToHost(CONTAINER_PATH, volumePath);
secondPage.finish();
new WaitWhile(new JobIsRunning());
if (!mockitoIsUsed()) {
new WaitWhile(new ConsoleHasNoChange());
} else {
runServer();
new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
}
String indexPage = getIndexPageContent();
String indexPageResource = getResourceAsString(INDEX_PAGE_PATH);
assertEquals(INDEX_PAGE_PATH + " wasnt mounted/displayed properly.", indexPage, indexPageResource);
}
use of org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition in project linuxtools by eclipse.
the class BasicSecurityTest method testBasicSecurity.
@Test
public void testBasicSecurity() {
DockerImagesTab imagesTab = openDockerImagesTab();
imagesTab.runImage(IMAGE_NAME + ":" + IMAGE_TAG);
ImageRunSelectionPage firstPage = new ImageRunSelectionPage(imagesTab);
firstPage.setContainerName(CONTAINER_NAME);
firstPage.setAllocatePseudoTTY();
firstPage.setKeepSTDINOpen();
firstPage.setBasicSecurity();
firstPage.finish();
if (mockitoIsUsed()) {
runContainer();
// MockDockerClientFactory.addContainer(this.client,
// this.createdContainer, this.containerInfo);
getConnection().refresh();
new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
}
new WaitWhile(new JobIsRunning());
PropertySheet propertiesView = openPropertiesTabForContainer("Inspect", CONTAINER_NAME);
String readonlyProp = propertiesView.getProperty("HostConfig", "ReadonlyRootfs").getPropertyValue();
assertTrue("Container is not running read-only!", readonlyProp.equals("true"));
String tmpfsProp = propertiesView.getProperty("HostConfig", "Tmpfs", "/run").getPropertyValue();
assertTrue("Container /run is not tmpfs rw,exec!", tmpfsProp.equals("rw,exec"));
tmpfsProp = propertiesView.getProperty("HostConfig", "Tmpfs", "/tmp").getPropertyValue();
assertTrue("Container /tmp is not tmpfs rw,exec!", tmpfsProp.equals("rw,exec"));
String capDropProp = propertiesView.getProperty("HostConfig", "CapDrop", "").getPropertyValue();
assertTrue("Container does not have capDrop all!", capDropProp.equals("all"));
}
Aggregations