Search in sources :

Example 6 with ImageRunSelectionPage

use of org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage 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 7 with ImageRunSelectionPage

use of org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage in project linuxtools by eclipse.

the class ContainerLogTest method before.

@Before
public void before() {
    deleteAllConnections();
    getConnection();
    pullImage(IMAGE_NAME);
    new WaitWhile(new JobIsRunning());
    DockerExplorerView explorer = new DockerExplorerView();
    explorer.open();
    getConnection().refresh();
    getConnection().getImage(IMAGE_NAME).run();
    ImageRunSelectionPage firstPage = new ImageRunSelectionPage(explorer);
    firstPage.setContainerName(CONTAINER_NAME);
    firstPage.setAllocatePseudoTTY();
    firstPage.setKeepSTDINOpen();
    firstPage.finish();
    if (mockitoIsUsed()) {
        runContainer();
        getConnection().refresh();
        new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
    }
    new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT);
}
Also used : ImageRunSelectionPage(org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage) DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) ContainerIsDeployedCondition(org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition) Before(org.junit.Before)

Example 8 with ImageRunSelectionPage

use of org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage in project linuxtools by eclipse.

the class DockerContainerTest method testRunDockerContainer.

@Test
public void testRunDockerContainer() {
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    assertTrue("Image has not been found!", imageIsDeployed(getCompleteImageName(IMAGE_NAME)));
    DockerExplorerView explorer = new DockerExplorerView();
    getConnection().getImage(getCompleteImageName(IMAGE_NAME)).run();
    ImageRunSelectionPage firstPage = new ImageRunSelectionPage(explorer);
    firstPage.setContainerName(CONTAINER_NAME);
    firstPage.finish();
    if (mockitoIsUsed()) {
        MockUtils.runContainer(DEFAULT_CONNECTION_NAME, IMAGE_NAME, IMAGE_TAG_LATEST, CONTAINER_NAME);
    }
    new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT);
    new WaitWhile(new ConsoleHasNoChange());
    assertTrue("Container does not exists!", containerIsDeployed(CONTAINER_NAME));
}
Also used : ImageRunSelectionPage(org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage) DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) ConsoleHasNoChange(org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange) Test(org.junit.Test) AbstractImageBotTest(org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)

Example 9 with ImageRunSelectionPage

use of org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage in project linuxtools by eclipse.

the class ExposePortTest method runContainer.

private void runContainer(String imageName, String imageTag, String containerName, DockerImagesTab imagesTab) {
    imagesTab.runImage(imageName + ":" + imageTag);
    ImageRunSelectionPage firstPage = new ImageRunSelectionPage(imagesTab);
    firstPage.setContainerName(containerName);
    firstPage.setPublishAllExposedPorts(false);
    firstPage.finish();
    new WaitWhile(new JobIsRunning());
    new WaitWhile(new ConsoleHasNoChange());
}
Also used : ImageRunSelectionPage(org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) ConsoleHasNoChange(org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange)

Example 10 with ImageRunSelectionPage

use of org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage 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

ImageRunSelectionPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage)15 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)14 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)14 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)10 AbstractImageBotTest (org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)8 Test (org.junit.Test)8 ContainerIsDeployedCondition (org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition)7 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)7 PropertySheet (org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet)5 ImageRunResourceVolumesVariablesPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunResourceVolumesVariablesPage)4 ConsoleHasNoChange (org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange)4 DockerExplorerView (org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView)3 DockerContainersTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab)2 Before (org.junit.Before)2 File (java.io.File)1 MockDockerTerminal (org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerTerminal)1 DockerTerminal (org.eclipse.linuxtools.docker.reddeer.ui.DockerTerminal)1