Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBIDE-25870 - Add CDK runtime download integration tests #1735

Merged
merged 1 commit into from May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions itests/org.jboss.tools.cdk.ui.bot.test/META-INF/MANIFEST.MF
Expand Up @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.jboss.tools.cdk.ui.bot.test
Bundle-Version: 3.5.0.qualifier
Bundle-Vendor: Red Hat
Require-Bundle: org.junit,
org.eclipse.reddeer.go;bundle-version="[2.0.0,3.0.0)",
org.eclipse.reddeer.go;bundle-version="[2.1.0,3.0.0)",
org.eclipse.wst.server.core;bundle-version="1.5.0",
org.eclipse.wst.server.ui;bundle-version="1.5.200",
org.eclipse.jdt.launching;bundle-version="3.7.0",
Expand All @@ -16,7 +16,6 @@ Require-Bundle: org.junit,
org.eclipse.core.externaltools;bundle-version="1.0.300",
org.eclipse.equinox.security;bundle-version="1.2.100",
org.eclipse.debug.ui;bundle-version="3.11.0",
org.eclipse.linuxtools.docker.core;bundle-version="[4.0.0,5.0.0)",
org.eclipse.linuxtools.docker.reddeer,
org.eclipse.tm.terminal.view.core;bundle-version="4.0.0",
org.eclipse.tm.terminal.view.ui;bundle-version="4.0.0",
Expand All @@ -43,7 +42,8 @@ Require-Bundle: org.junit,
org.jboss.ide.eclipse.as.core;bundle-version="3.0.0",
org.jboss.ide.eclipse.as.wtp.core;bundle-version="3.1.1",
org.jboss.ide.eclipse.as.wtp.ui;bundle-version="3.1.1",
org.jboss.tools.common.reddeer
org.jboss.tools.common.reddeer,
org.jboss.tools.runtime.reddeer
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-BundleShape: jar
Bundle-Localization: plugin
Expand Down
8 changes: 4 additions & 4 deletions itests/org.jboss.tools.cdk.ui.bot.test/pom.xml
Expand Up @@ -38,15 +38,15 @@
</properties>
</profile>
<profile>
<id>cdk32-all-tests</id>
<id>minishift-tests</id>
<properties>
<suiteClass>org.jboss.tools.cdk.ui.bot.test.CDK32AllTestsSuite</suiteClass>
<suiteClass>org.jboss.tools.cdk.ui.bot.test.MinishiftAllTestsSuite</suiteClass>
</properties>
</profile>
<profile>
<id>minishift-all-tests</id>
<id>ui-tests</id>
<properties>
<suiteClass>org.jboss.tools.cdk.ui.bot.test.MinishiftAllTestsSuite</suiteClass>
<suiteClass>org.jboss.tools.cdk.ui.bot.test.CDKUITestsSuite</suiteClass>
</properties>
</profile>
</profiles>
Expand Down

This file was deleted.

Expand Up @@ -16,6 +16,7 @@

import org.eclipse.reddeer.common.exception.RedDeerException;
import org.jboss.tools.cdk.reddeer.core.enums.CDKHypervisor;
import org.jboss.tools.cdk.reddeer.utils.CDKUtils;
import org.jboss.tools.cdk.ui.bot.test.utils.CDKTestUtils;
import org.jboss.tools.openshift.common.core.utils.StringUtils;

Expand All @@ -27,19 +28,18 @@ public abstract class CDKAbstractTest {
public static final String SERVER_ADAPTER_32 = "Container Development Environment 3.2+";
public static final String SERVER_ADAPTER_MINISHIFT = "Minishift 1.7+";

// General parameters
public static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().contains("win");
public static final boolean IS_LINUX = System.getProperty("os.name").toLowerCase().contains("linux");
public static final String FOLDER = IS_LINUX ? "linux" : (IS_WINDOWS ? "win" : "mac");
// General parameters
public static final String FOLDER = CDKUtils.IS_LINUX ? "linux" : (CDKUtils.IS_WINDOWS ? "win" : "mac");
public static final String separator = System.getProperty("file.separator");
public static final String MINISHIFT_CONFIG_MINIMAL = " --disk-size 5GB --memory 2GB --cpus 1";
public static final String SKIP_REGISTRATION = "--skip-registration";
public static final String RUNTIMES_DIRECTORY= System.getProperty("user.dir") + separator + "runtimes";

// mock files
protected static final String MOCK_CDK320 = getProjectAbsolutePath("resources/cdk-files/" + FOLDER + "/cdk-3.2.0-mock" + (IS_WINDOWS ? ".bat" : ""));
protected static final String MOCK_CDK311 = getProjectAbsolutePath("resources/cdk-files/" + FOLDER + "/cdk-3.1.1-mock" + (IS_WINDOWS ? ".bat" : ""));
protected static final String MOCK_MINISHIFT131 = getProjectAbsolutePath("resources/cdk-files/" + FOLDER + "/minishift-1.3.1-mock" + (IS_WINDOWS ? ".bat" : ""));
protected static final String MOCK_MINISHIFT170 = getProjectAbsolutePath("resources/cdk-files/" + FOLDER + "/minishift-1.7.0-mock" + (IS_WINDOWS ? ".bat" : ""));
protected static final String MOCK_CDK320 = getProjectAbsolutePath("resources/cdk-files/" + FOLDER + "/cdk-3.2.0-mock" + (CDKUtils.IS_WINDOWS ? ".bat" : ""));
protected static final String MOCK_CDK311 = getProjectAbsolutePath("resources/cdk-files/" + FOLDER + "/cdk-3.1.1-mock" + (CDKUtils.IS_WINDOWS ? ".bat" : ""));
protected static final String MOCK_MINISHIFT131 = getProjectAbsolutePath("resources/cdk-files/" + FOLDER + "/minishift-1.3.1-mock" + (CDKUtils.IS_WINDOWS ? ".bat" : ""));
protected static final String MOCK_MINISHIFT170 = getProjectAbsolutePath("resources/cdk-files/" + FOLDER + "/minishift-1.7.0-mock" + (CDKUtils.IS_WINDOWS ? ".bat" : ""));

// CDK Test suite parameters
public static final String MINISHIFT_PROFILE = "minishift";
Expand All @@ -58,7 +58,7 @@ public abstract class CDKAbstractTest {
CDK_MINISHIFT = CDKTestUtils.getSystemProperty("cdk.minishift");
CDK32_MINISHIFT = CDKTestUtils.getSystemProperty("cdk32.minishift");
MINISHIFT_HYPERVISOR = CDKTestUtils.getSystemProperty("hypervisor");
DEFAULT_MINISHIFT_HOME = System.getProperty("user.home") + separator + ".minishift";
DEFAULT_MINISHIFT_HOME = System.getProperty("user.home") + separator + ".minishift";
}

public static String assignMinishiftHypervisor() {
Expand Down
Expand Up @@ -25,6 +25,11 @@
import org.jboss.tools.cdk.ui.bot.test.server.wizard.CDK32ServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.CDK3ServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.MinishiftServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.CDK32DownloadRuntimeTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.CDK3DownloadRuntimeTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.DownloadContainerRuntimeDefaultSettingsTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.DownloadRuntimesWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.MinishiftDownloadRuntimeTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

Expand All @@ -38,6 +43,13 @@
CDK32ServerWizardTest.class,
MinishiftServerWizardTest.class,

// Downloading and installation of CDK/Minishift runtimes via new server wizard
CDK3DownloadRuntimeTest.class,
CDK32DownloadRuntimeTest.class,
MinishiftDownloadRuntimeTest.class,
DownloadContainerRuntimeDefaultSettingsTest.class,
DownloadRuntimesWizardTest.class,

// Server editor tests by server adapter type
CDK3ServerEditorTest.class,
CDK32ServerEditorTest.class,
Expand Down
Expand Up @@ -12,6 +12,8 @@

import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.jboss.tools.cdk.ui.bot.test.server.adapter.CDK32IntegrationTest;
import org.jboss.tools.cdk.ui.bot.test.server.adapter.CDK32ServerAdapterProfilesTest;
import org.jboss.tools.cdk.ui.bot.test.server.adapter.CDKServerAdapterSetupCDKTest;
import org.jboss.tools.cdk.ui.bot.test.server.adapter.openshift.CDKImageRegistryUrlDiscoveryTest;
import org.jboss.tools.cdk.ui.bot.test.server.editor.CDK32ServerEditorTest;
import org.jboss.tools.cdk.ui.bot.test.server.editor.CDK3ServerEditorTest;
Expand All @@ -20,20 +22,44 @@
import org.jboss.tools.cdk.ui.bot.test.server.wizard.CDK32ServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.CDK3ServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.MinishiftServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.DownloadLatestContainerRuntimeTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.DownloadRuntimesWizardTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(RedDeerSuite.class)
@Suite.SuiteClasses({
CDK3ServerWizardTest.class,
CDK32ServerWizardTest.class,
MinishiftServerWizardTest.class,
CDK3ServerEditorTest.class,
CDK32ServerEditorTest.class,
MinishiftServerEditorTest.class,
CDKLaunchConfigurationTest.class,
CDKImageRegistryUrlDiscoveryTest.class,
CDK32IntegrationTest.class
// UI integration tests

// Wizard tests by server adapter type
CDK3ServerWizardTest.class,
CDK32ServerWizardTest.class,
MinishiftServerWizardTest.class,

// Downloading and installation of CDK/Minishift runtimes via new server wizard
DownloadLatestContainerRuntimeTest.class,
DownloadRuntimesWizardTest.class,

// Server editor tests by server adapter type
CDK3ServerEditorTest.class,
CDK32ServerEditorTest.class,
MinishiftServerEditorTest.class,
CDKLaunchConfigurationTest.class,

// Setup CDK context menu item tests
CDKServerAdapterSetupCDKTest.class,

// Integration tests dependent on CDK start up

// Main integration test of devstudio and CDK, is using different profile for clear start
// and registers cdk rhel image
CDK32IntegrationTest.class,

// Testing of Image registry URL discovery in OS connection
CDKImageRegistryUrlDiscoveryTest.class,

// Integration test for creating/operating of CDK 3.2+ server adapter with multiple profiles set
CDK32ServerAdapterProfilesTest.class
})
/**
* @author ondrej dockal
Expand Down
@@ -0,0 +1,58 @@
/*******************************************************************************
* Copyright (c) 2018 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.cdk.ui.bot.test;

import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.jboss.tools.cdk.ui.bot.test.server.adapter.CDKServerAdapterSetupCDKTest;
import org.jboss.tools.cdk.ui.bot.test.server.editor.CDK32ServerEditorTest;
import org.jboss.tools.cdk.ui.bot.test.server.editor.CDK3ServerEditorTest;
import org.jboss.tools.cdk.ui.bot.test.server.editor.MinishiftServerEditorTest;
import org.jboss.tools.cdk.ui.bot.test.server.editor.launch.CDKLaunchConfigurationTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.CDK32ServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.CDK3ServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.MinishiftServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.DownloadContainerRuntimeDefaultSettingsTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.DownloadLatestContainerRuntimeTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.DownloadRuntimesWizardTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(RedDeerSuite.class)
@Suite.SuiteClasses({

// UI integration tests

// Wizard tests by server adapter type
CDK3ServerWizardTest.class,
CDK32ServerWizardTest.class,
MinishiftServerWizardTest.class,

// Downloading and installation of CDK/Minishift runtimes via new server wizard
DownloadLatestContainerRuntimeTest.class,
DownloadContainerRuntimeDefaultSettingsTest.class,
DownloadRuntimesWizardTest.class,

// Server editor tests by server adapter type
CDK3ServerEditorTest.class,
CDK32ServerEditorTest.class,
MinishiftServerEditorTest.class,
CDKLaunchConfigurationTest.class,

// Setup CDK context menu item tests
CDKServerAdapterSetupCDKTest.class,
})
/**
*
* @author odockal
*
*/
public class CDKUITestsSuite {
}
Expand Up @@ -15,13 +15,15 @@
import org.jboss.tools.cdk.ui.bot.test.server.adapter.MinishiftServerAdapterTest;
import org.jboss.tools.cdk.ui.bot.test.server.editor.MinishiftServerEditorTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.MinishiftServerWizardTest;
import org.jboss.tools.cdk.ui.bot.test.server.wizard.download.MinishiftDownloadRuntimeTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(RedDeerSuite.class)
@Suite.SuiteClasses({
MinishiftServerWizardTest.class,
MinishiftServerEditorTest.class,
MinishiftDownloadRuntimeTest.class,
MinishiftServerAdapterTest.class,
MinishiftServerAdapterProfilesTest.class
})
Expand Down
Expand Up @@ -87,14 +87,14 @@ public void setupSecondAdapter() {
@Test
public void testCDK32ServerAdapterWithMultipleProfiles() {
// fisrt adapter start verification
startServerAdapter(() -> { skipRegistration(getCDKServer());}, false);
startServerAdapter(() -> { skipRegistrationViaFlag(getCDKServer(), true);}, false);
int conCount = view.getOpenShift3Connections().size();
int docCount = getDockerConnectionCreatedByCDK(dockerView, DOCKER_DAEMON_CONNECTION).size();
assertEquals("Expected only one OS connection, got " + conCount, 1, conCount);
assertEquals("Expected only one Docker connection, got " + docCount, 1, docCount);
// second adapter start verification
startServerAdapter(getSecondCDKServer(),
() -> { skipRegistration(getSecondCDKServer());
() -> { skipRegistrationViaFlag(getSecondCDKServer(), true);
}, false);
// check counts of connections
conCount = view.getOpenShift3Connections().size();
Expand Down
Expand Up @@ -43,7 +43,7 @@ public static void setup() {
@Test
public void testCDK3ServerAdapter() {
// cdk start verification
startServerAdapter(() -> skipRegistration(getCDKServer()), true);
startServerAdapter(() -> skipRegistrationViaFlag(getCDKServer(), true), true);
// OS3 and docker connection created verification
testOpenshiftConnection(null, OPENSHIFT_USERNAME);
testDockerConnection(DOCKER_DAEMON_CONNECTION);
Expand Down
Expand Up @@ -53,6 +53,7 @@
import org.jboss.tools.cdk.reddeer.server.exception.CDKServerException;
import org.jboss.tools.cdk.reddeer.server.ui.CDKServer;
import org.jboss.tools.cdk.reddeer.server.ui.CDKServersView;
import org.jboss.tools.cdk.reddeer.server.ui.editor.CDK32ServerEditor;
import org.jboss.tools.cdk.reddeer.server.ui.editor.CDK3ServerEditor;
import org.jboss.tools.cdk.reddeer.server.ui.editor.MinishiftServerEditor;
import org.jboss.tools.cdk.reddeer.server.ui.editor.launch.configuration.CDKLaunchConfigurationDialog;
Expand Down Expand Up @@ -181,6 +182,16 @@ protected void addParamsToCDKLaunchConfig(Server server, String paramsToAdd) {
launchConfig.ok();
}

protected void skipRegistrationViaFlag(Server server, boolean checked) {
server.open();
CDK32ServerEditor editor = new CDK32ServerEditor(server.getLabel().getName());
editor.getAddSkipRegistrationOnStartCheckBox().toggle(checked);
new WaitUntil(new SystemJobIsRunning(new JobMatcher(CDKLabel.Job.MINISHIFT_VALIDATION_JOB)), TimePeriod.SHORT, false);
new WaitWhile(new SystemJobIsRunning(new JobMatcher(CDKLabel.Job.MINISHIFT_VALIDATION_JOB)), TimePeriod.DEFAULT, false);
CDKTestUtils.performSave(editor.getEditorPart());
editor.close();
}

protected void skipRegistration(Server server) {
addParamsToCDKLaunchConfig(server, SKIP_REGISTRATION);
}
Expand Down
Expand Up @@ -87,15 +87,14 @@ public void setupSecondAdapter() {
@Test
public void testMinishiftServerAdapterWithMultipleProfiles() {
// fisrt adapter start verification
startServerAdapter(() -> { skipRegistration(getCDKServer());}, false);
startServerAdapter(() -> {}, false);
int conCount = view.getOpenShift3Connections().size();
int docCount = getDockerConnectionCreatedByCDK(dockerView, DOCKER_DAEMON_CONNECTION).size();
assertEquals("Expected only one OS connection, got " + conCount, 1, conCount);
assertEquals("Expected only one Docker connection, got " + docCount, 1, docCount);
// second adapter start verification
startServerAdapter(getSecondCDKServer(),
() -> { skipRegistration(getCDKServer());
}, false);
() -> {}, false);
// check counts of connections
conCount = view.getOpenShift3Connections().size();
docCount = getDockerConnectionCreatedByCDK(dockerView, DOCKER_DAEMON_CONNECTION).size();
Expand Down
Expand Up @@ -69,7 +69,7 @@ public static void tearDownCDKImageResgitryUrlAbstract() {
@Before
public void setupAdapter() {
startServerAdapterIfNotRunning(() -> {
skipRegistration(getCDKServer());
skipRegistrationViaFlag(getCDKServer(), true);
}, false);
wizard = getOpenshiftConnectionWizard(findOpenShiftConnection(null, OPENSHIFT_USERNAME));
assertTrue(wizard.getAuthSection().getMethod().equals(AuthenticationMethod.BASIC));
Expand Down
Expand Up @@ -69,7 +69,7 @@ public void testImageRegistryUrlIsUpdated() {
stopServerAdapter();
// start server adapter -> should bring up the value of registry url in existing
// connection
startServerAdapter(() -> skipRegistration(getCDKServer()), false);
startServerAdapter(() -> skipRegistrationViaFlag(getCDKServer(), true), false);
wizard = getOpenshiftConnectionWizard(findOpenShiftConnection(null, OPENSHIFT_USERNAME));
switchOffPasswordSaving(wizard);
checkImageRegistryUrl(wizard, OPENSHIFT_REGISTRY);
Expand Down Expand Up @@ -101,7 +101,7 @@ public void testAllConnectionsImageRegistryUrlUpdated() {
newWizard = null;
// stop and start server adapter
stopServerAdapter();
startServerAdapter(() -> skipRegistration(getCDKServer()), false);
startServerAdapter(() -> skipRegistrationViaFlag(getCDKServer(), true), false);
// check that both connections have filled image registry url
try {
wizard = getOpenshiftConnectionWizard(findOpenShiftConnection(null, OPENSHIFT_USERNAME));
Expand Down