Search in sources :

Example 11 with DockerImagesTab

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));
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertySheet(org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet) TableItem(org.eclipse.reddeer.swt.api.TableItem) DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) Test(org.junit.Test) AbstractImageBotTest(org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)

Example 12 with DockerImagesTab

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();
}
Also used : DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) Test(org.junit.Test)

Example 13 with DockerImagesTab

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"));
}
Also used : ImageRunSelectionPage(org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertySheet(org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet) DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) ContainerIsDeployedCondition(org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition) Test(org.junit.Test) AbstractImageBotTest(org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)

Example 14 with DockerImagesTab

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);
}
Also used : DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) Test(org.junit.Test) AbstractImageBotTest(org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)

Example 15 with DockerImagesTab

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"));
}
Also used : ImageRunSelectionPage(org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) MockDockerTerminal(org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerTerminal) DockerTerminal(org.eclipse.linuxtools.docker.reddeer.ui.DockerTerminal) DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Aggregations

DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)25 Test (org.junit.Test)18 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)16 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)16 AbstractImageBotTest (org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)12 ImageRunSelectionPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage)10 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)7 PropertySheet (org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet)7 ContainerIsDeployedCondition (org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition)6 ImageRunResourceVolumesVariablesPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunResourceVolumesVariablesPage)3 DockerContainersTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab)3 File (java.io.File)2 ConsoleHasNoChange (org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange)2 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)2 IOException (java.io.IOException)1 MockDockerTerminal (org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerTerminal)1 DockerComposePreferencePage (org.eclipse.linuxtools.docker.reddeer.preferences.DockerComposePreferencePage)1 DockerExplorerView (org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView)1 DockerImageHierarchyTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImageHierarchyTab)1 DockerTerminal (org.eclipse.linuxtools.docker.reddeer.ui.DockerTerminal)1