use of org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab in project linuxtools by eclipse.
the class ImageTabTest method testImageTab.
@Test
public void testImageTab() {
pullImage(IMAGE_HELLO_WORLD);
DockerImagesTab imageTab = new DockerImagesTab();
imageTab.activate();
imageTab.refresh();
new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT);
String idFromTable = "";
String repoTagsFromTable = "";
String createdFromTable = "";
String sizeFromTable = "";
for (TableItem item : imageTab.getTableItems()) {
if (item.getText(1).contains(IMAGE_HELLO_WORLD)) {
idFromTable = item.getText();
repoTagsFromTable = item.getText(1);
createdFromTable = item.getText(2);
sizeFromTable = item.getText(3).replaceAll(".", "").replaceAll(" MB", "");
item.click();
}
}
idFromTable = idFromTable.replace("sha256:", "");
getConnection().getImage(getCompleteImageName(IMAGE_HELLO_WORLD)).select();
PropertySheet propertiesView = new PropertySheet();
propertiesView.open();
propertiesView.selectTab("Info");
String idProp = propertiesView.getProperty("Id").getPropertyValue();
String repoTagsProp = propertiesView.getProperty("RepoTags").getPropertyValue();
String createdProp = propertiesView.getProperty("Created").getPropertyValue();
String sizeProp = propertiesView.getProperty("VirtualSize").getPropertyValue();
assertTrue("Id in table and in Properties do not match!", idProp.contains(idFromTable));
assertTrue("RepoTags in table and in Properties do not match!", repoTagsProp.equals(repoTagsFromTable));
assertTrue("Created in table and in Properties do not match!", createdProp.equals(createdFromTable));
assertTrue("Size in table and in Properties do not match!", sizeProp.startsWith(sizeFromTable));
}
use of org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab in project linuxtools by eclipse.
the class PerspectiveTest method testDockerImagesTabPresent.
@Test
public void testDockerImagesTabPresent() {
DockerImagesTab tab = new DockerImagesTab();
tab.open();
}
use of org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab 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"));
}
use of org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab in project linuxtools by eclipse.
the class ExposePortTest method testExposePort.
@Test
public void testExposePort() throws IOException {
pullImage(IMAGE_UHTTPD, IMAGE_TAG_LATEST);
DockerImagesTab imagesTab = openDockerImagesTab();
runContainer(IMAGE_UHTTPD, IMAGE_TAG_LATEST, CONTAINER_NAME, imagesTab);
if (mockitoIsUsed()) {
MockUtils.runContainer(DEFAULT_CONNECTION_NAME, IMAGE_UHTTPD, IMAGE_TAG_LATEST, CONTAINER_NAME);
}
assertPortIsAccessible(EXPOSED_PORT);
}
use of org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab in project linuxtools by eclipse.
the class LinkContainersTest method runAlpineLinux.
public void runAlpineLinux(String imageName, String containerName) {
String serverAddress = getHttpServerAddress(CONTAINER_NAME_HTTP_SERVER);
DockerImagesTab imagesTab = openDockerImagesTab();
imagesTab.runImage(imageName);
ImageRunSelectionPage firstPage = openImageRunSelectionPage(containerName, false, imagesTab);
firstPage.setContainerName(containerName);
firstPage.setCommand(serverAddress + ":80");
firstPage.addLinkToContainer(CONTAINER_NAME_HTTP_SERVER, "http_server");
firstPage.setPublishAllExposedPorts(false);
firstPage.setAllocatePseudoTTY();
firstPage.setKeepSTDINOpen();
firstPage.finish();
new WaitWhile(new JobIsRunning());
DockerTerminal dt = new DockerTerminal();
dt.open();
if (mockitoIsUsed()) {
mockServerContainer();
dt = MockDockerTerminal.setText("text").build();
}
String terminalText = dt.getTextFromPage("/" + containerName);
assertTrue("No output from terminal!", !terminalText.isEmpty());
assertTrue("Containers are not linked!", !terminalText.contains("Connection refused"));
}
Aggregations