diff --git a/package.json b/package.json index 279c74a54..0181910c8 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "test": "npm run unit-tests && npm run func-tests", "unit-tests": "gulp unit-tests", "func-tests": "./run_ui_func_tests.sh", - "nightly-func-tests": "./run_ui_func_tests.sh static/tests/functional/nightly/*.js" + "nightly-func-tests": "./run_ui_func_tests.sh static/tests/functional/nightly/*.js", + "component-tests": "./run_component_registry_tests.sh" }, "dependencies": { "async-props": "0.3.2", diff --git a/run_component_registry_tests.sh b/run_component_registry_tests.sh new file mode 100755 index 000000000..4148e7cc4 --- /dev/null +++ b/run_component_registry_tests.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +# Copyright 2016 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +set -eu + +# Variables for tests +export NO_NAILGUN_START=${NO_NAILGUN_START:-0} +export TEST_PREFIX=${TEST_PREFIX:-'test_*'} +export FUEL_WEB_ROOT=$(readlink -f ${FUEL_WEB_ROOT:-"$(dirname $0)/../fuel-web"}) +export ARTIFACTS=${ARTIFACTS:-"$(pwd)/test_run/ui_component"} +export CONF_PATH="$(pwd)/static/tests/functional/component_registry/plugin_conf" +export SCRIPT_PATH="${CONF_PATH}/update_components.sh" +export PLUGIN_RPM=${PLUGIN_RPM:-''} +if [ -z "${PLUGIN_RPM}" ]; then + plugins='https://product-ci.infra.mirantis.net/view/All/job/9.0.build-fuel-plugins' + path='lastSuccessfulBuild/artifact/built_plugins/fuel_plugin_example_v4-4.0-4.0.0-1.noarch.rpm' + plugin_url=${PLUGIN_URL:-"${plugins}/${path}"} + + export PLUGIN_RPM="${CONF_PATH}/plugin.rpm" + wget -O "${PLUGIN_RPM}" "${plugin_url}" +fi + +# Variables for nailgun +export NAILGUN_PORT=${NAILGUN_PORT:-5544} +export NAILGUN_START_MAX_WAIT_TIME=${NAILGUN_START_MAX_WAIT_TIME:-30} +export NAILGUN_DB_HOST=${NAILGUN_DB_HOST:-/var/run/postgresql} +export NAILGUN_DB=${NAILGUN_DB:-nailgun} +export NAILGUN_DB_USER=${NAILGUN_DB_USER:-nailgun} +export NAILGUN_DB_USERPW=${NAILGUN_DB_USERPW:-nailgun} +export DB_ROOT=${DB_ROOT:-postgres} + +export NAILGUN_ROOT=$FUEL_WEB_ROOT/nailgun +export NAILGUN_STATIC=$ARTIFACTS/static +export NAILGUN_TEMPLATES=$NAILGUN_STATIC +export NAILGUN_CHECK_URL='/api/version' + +mkdir -p "$ARTIFACTS" + +function install_plugin { + plugin_rpm=$1 + + mkdir -p "${nailgun_plugins_path}" + local plugin_dir=$(sudo alien -i "${plugin_rpm}" | grep -oP 'Setting up \K[^ ]*') + export PLUGIN_PATH=$(echo ${nailgun_plugins_path}/${plugin_dir//[-_]/\*}) + + meta=${PLUGIN_PATH}/metadata.yaml + plugin_name=$(grep -oP '^name: \K(.*)' "${meta}") + plugin_version=$(grep -oP '^version: \K(.*)' "${meta}") + + sudo sed -i -e "s/fuel_version: \['8.0'\]/fuel_version: \['10.0'\]/" "${meta}" + sudo sed -i -e "s/fuel_version: \['9.0'\]/fuel_version: \['10.0'\]/" "${meta}" + sudo sed -i -e "s/mitaka-9.0/newton-10.0/" "${meta}" + + fuel --os-username admin --os-password admin plugins \ + --register "${plugin_name}==${plugin_version//\'/}" +} + +function remove_plugin { + fuel --os-username admin --os-password admin plugins \ + --remove "${plugin_name}==${plugin_version//\'/}" 2>/dev/null || \ + echo "${plugin_name} was removed" +} + +function run_component_tests { + local GULP='./node_modules/.bin/gulp' + local TESTS_DIR='static/tests/functional/component_registry' + local TESTS=$TESTS_DIR/${TEST_PREFIX}.js + local result=0 + + export SERVER_ADDRESS=${SERVER_ADDRESS:-'127.0.0.1'} + export SERVER_PORT=${NAILGUN_PORT} + export nailgun_plugins_path='/var/www/nailgun/plugins' + + pip install python-fuelclient + fuelclient="${VENV}/lib/python2.7/site-packages/fuelclient" + sed -i -e "s/if self.auth_required/if True/" "${fuelclient}/client.py" + + echo "Building tests..." + ${GULP} intern:transpile + + if [ "${NO_NAILGUN_START}" -ne 1 ]; then + pushd "$FUEL_WEB_ROOT" > /dev/null + tox -e stop + tox -e cleanup + tox -e start + popd > /dev/null + fi + + ${GULP} build --no-sourcemaps --extra-entries=sinon --static-dir="$NAILGUN_STATIC" + if [ $? -ne 0 ]; then + return 1 + fi + + install_plugin "${PLUGIN_RPM}" + + for test_case in $TESTS; do + echo "INFO: Running test case ${test_case}" + + ARTIFACTS=$ARTIFACTS \ + ${GULP} functional-tests --no-transpile --suites="${test_case}" || result=1 + done + + remove_plugin + + if [ "${NO_NAILGUN_START}" -ne 1 ]; then + pushd "$FUEL_WEB_ROOT" > /dev/null + tox -e stop + popd > /dev/null + fi + + return $result +} + +run_component_tests diff --git a/static/tests/functional/component_registry/component_helpers.js b/static/tests/functional/component_registry/component_helpers.js new file mode 100644 index 000000000..873ed51e9 --- /dev/null +++ b/static/tests/functional/component_registry/component_helpers.js @@ -0,0 +1,59 @@ +/* + * Copyright 2016 Mirantis, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + +import _ from 'intern/dojo/node!lodash'; +import childProcess from 'intern/dojo/node!child_process'; +import Command from 'intern/dojo/node!leadfoot/Command'; +import 'tests/functional/helpers'; + +_.defaults(Command.prototype, { + updatePlugin(files) { + return new this.constructor(this, function() { + return this.parent + .then(() => { + childProcess.exec('/bin/sh ${SCRIPT_PATH} ' + files, + (err) => { + if (err) return; + }); + }) + .sleep(250); // wait for plugin update + }); + }, + newClusterFillName(modal) { + return new this.constructor(this, function() { + return this.parent + .clickByCssSelector('.create-cluster') + .then(() => modal.waitToOpen()) + .setInputValue('[name=name]', 'Temp'); + }); + }, + assertNextButtonEnabled() { + return new this.constructor(this, function() { + return this.parent + .assertElementNotExists('button.next-pane-btn.disabled', + 'Next button is disabled'); + }); + }, + deleteCluster(modal) { + return new this.constructor(this, function() { + return this.parent + .clickByCssSelector('button.delete-environment-btn') + .then(() => modal.waitToOpen()) + .clickByCssSelector('button.remove-cluster-btn') + .then(() => modal.waitToClose()); + }); + } +}); diff --git a/static/tests/functional/component_registry/plugin_conf/contrail_default.yaml b/static/tests/functional/component_registry/plugin_conf/contrail_default.yaml new file mode 100644 index 000000000..a7f07e781 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/contrail_default.yaml @@ -0,0 +1,12 @@ +- name: 'network:neutron:contrail' + label: 'Contrail' + description: 'Contrail SDN networking' + bind: !!pairs + - "cluster:net_provider": "neutron" + - "cluster:net_segment_type": "tun" + compatible: + - name: 'hypervisor:kvm' + - name: 'hypervisor:qemu' + incompatible: + - name: 'hypervisor:vmware' + description: 'Contrail plugin is not compatible with VMware for now' diff --git a/static/tests/functional/component_registry/plugin_conf/dvs_default.yaml b/static/tests/functional/component_registry/plugin_conf/dvs_default.yaml new file mode 100644 index 000000000..769072145 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/dvs_default.yaml @@ -0,0 +1,11 @@ +- name: 'network:neutron:ml2:dvs' + label: 'Neutron with VMware DVS' + description: 'Neutron with VMware DVS ML2 plugin' + requires: + - name: 'network:neutron:core:ml2' + - name: 'hypervisor:vmware' + message: 'The VMware DVS plugin requires vCenter as the hypervisor option.' + compatible: + - name: 'hypervisor:*' + - name: 'network:neutron:ml2:vlan' + - name: 'network:neutron:core:ml2' diff --git a/static/tests/functional/component_registry/plugin_conf/nsxv_default.yaml b/static/tests/functional/component_registry/plugin_conf/nsxv_default.yaml new file mode 100644 index 000000000..f82e6e5c4 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/nsxv_default.yaml @@ -0,0 +1,21 @@ +- name: "network:neutron:core:nsx" + label: "Neutron with NSXv plugin." + description: "NSXv plugin for Fuel allows to integrate Mirantis OpenStack with VMware NSXv network virtualization platform." + bind: !!pairs + - "cluster:net_segment_type": "tun" + compatible: + - name: "hypervisor:vmware" + - name: "hypervisor:qemu" + - name: "storage:block:lvm" + - name: "storage:image:ceph" + - name: "storage:object:ceph" + - name: "additional_service:ceilometer" + incompatible: + - name: "storage:block:ceph" + - name: "storage:ephemeral:ceph" + - name: "additional_service:sahara" + - name: "additional_service:murano" + - name: "additional_service:ironic" + requires: + - name: "hypervisor:vmware" + message: "NSXv requires use vCenter." diff --git a/static/tests/functional/component_registry/plugin_conf/test_addit_smile.yaml b/static/tests/functional/component_registry/plugin_conf/test_addit_smile.yaml new file mode 100644 index 000000000..3532ae7fb --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_addit_smile.yaml @@ -0,0 +1,16 @@ +- name: 'additional_service:smile' + label: 'smile' + description: 'smile' + incompatible: + - name: 'network:nova_network' + requires: + - name: 'hypervisor:vmware' + - name: 'network:neutron:ml2:dvs' + compatible: + - name: 'additional_service:sahara' +- name: 'network:neutron:ml2:dvs' + label: 'dvs' + description: 'dvs' + +- name: 'network:nova_network' + label: 'Nova network' diff --git a/static/tests/functional/component_registry/plugin_conf/test_addit_smile_ceil.yaml b/static/tests/functional/component_registry/plugin_conf/test_addit_smile_ceil.yaml new file mode 100644 index 000000000..198f3920b --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_addit_smile_ceil.yaml @@ -0,0 +1,9 @@ +- name: 'additional_service:smile' + label: 'smile' + description: 'smile' + incompatible: + - name: 'additional_service:ceilometer' + requires: + - name: 'additional_service:murano' + compatible: + - name: 'additional_service:sahara' diff --git a/static/tests/functional/component_registry/plugin_conf/test_addit_smile_ironic.yaml b/static/tests/functional/component_registry/plugin_conf/test_addit_smile_ironic.yaml new file mode 100644 index 000000000..ab530e550 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_addit_smile_ironic.yaml @@ -0,0 +1,9 @@ +- name: 'additional_service:smile' + label: 'smile' + description: 'smile' + incompatible: + - name: 'additional_service:ironic' + requires: + - name: 'additional_service:sahara' + compatible: + - name: 'additional_service:murano' diff --git a/static/tests/functional/component_registry/plugin_conf/test_addit_smile_sahara.yaml b/static/tests/functional/component_registry/plugin_conf/test_addit_smile_sahara.yaml new file mode 100644 index 000000000..7602eef31 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_addit_smile_sahara.yaml @@ -0,0 +1,12 @@ +- name: 'additional_service:smile' + label: 'smile' + description: 'smile' + incompatible: + - name: 'network:neutron:ml2:tun' + - name: 'hypervisor:vmware' + requires: + - name: 'additional_service:sahara' + compatible: + - name: 'storage:block:ceph' +- name: 'network:neutron:ml2:dvs' + label: 'DVS network' diff --git a/static/tests/functional/component_registry/plugin_conf/test_hyperv_green_light_1.yaml b/static/tests/functional/component_registry/plugin_conf/test_hyperv_green_light_1.yaml new file mode 100644 index 000000000..bd92e5a9e --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_hyperv_green_light_1.yaml @@ -0,0 +1,13 @@ +- name: 'network:neutron:core:nsx' + label: 'Neutron with NSXv plugin.' + description: 'NSXv plugin for Fuel allows to integrate Mirantis OpenStack with VMware NSXv network virtualization platform.' + bind: !!pairs + - 'cluster:net_segment_type': 'tun' + compatible: + - name: 'hypervisor:vmware' + - name: 'hypervisor:kvm' + - name: 'hypervisor:qemu' + - name: 'storage:block:lvm' + requires: + - name: 'hypervisor:vmware' + message: 'NSXv requires the usage of vCenter.' diff --git a/static/tests/functional/component_registry/plugin_conf/test_hyperv_green_light_2.yaml b/static/tests/functional/component_registry/plugin_conf/test_hyperv_green_light_2.yaml new file mode 100644 index 000000000..f54c35b34 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_hyperv_green_light_2.yaml @@ -0,0 +1,11 @@ +- name: 'network:neutron:core:nsx' + label: 'Neutron with NSXv plugin.' + description: 'NSXv plugin for Fuel allows to integrate Mirantis OpenStack with VMware NSXv network virtualization platform.' + bind: !!pairs + - 'cluster:net_segment_type': 'tun' + compatible: + - name: 'hypervisor:vmware' + - name: 'storage:block:lvm' + requires: + - name: 'hypervisor:vmware' + message: 'NSXv requires the usage of vCenter.' diff --git a/static/tests/functional/component_registry/plugin_conf/test_hyperv_rain.yaml b/static/tests/functional/component_registry/plugin_conf/test_hyperv_rain.yaml new file mode 100644 index 000000000..344224640 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_hyperv_rain.yaml @@ -0,0 +1,8 @@ +- name: 'hypervisor:libvirt:rain' + label: 'rain' + description: 'rain hypervisor' + incompatible: + - name: 'hypervisor:xen' +- name: 'hypervisor:xen' + label: 'xen' + description: 'xen hypervisor' diff --git a/static/tests/functional/component_registry/plugin_conf/test_hyperv_rain1.yaml b/static/tests/functional/component_registry/plugin_conf/test_hyperv_rain1.yaml new file mode 100644 index 000000000..cde8b6a30 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_hyperv_rain1.yaml @@ -0,0 +1,9 @@ +- name: 'hypervisor:libvirt:rain1' + label: 'rain' + description: 'rain hypervisor' + incompatible: + - name: 'hypervisor:qemu' + - name: 'hypervisor:xen' +- name: 'hypervisor:xen' + label: 'xen' + description: 'xen hypervisor' diff --git a/static/tests/functional/component_registry/plugin_conf/test_hyperv_sun.yaml b/static/tests/functional/component_registry/plugin_conf/test_hyperv_sun.yaml new file mode 100644 index 000000000..c081ce621 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_hyperv_sun.yaml @@ -0,0 +1,5 @@ +- name: 'hypervisor:libvirt:sun' + label: 'sun' + description: 'sun hypervisor' + incompatible: + - name: 'hypervisor:qemu' diff --git a/static/tests/functional/component_registry/plugin_conf/test_hyperv_xen.yaml b/static/tests/functional/component_registry/plugin_conf/test_hyperv_xen.yaml new file mode 100644 index 000000000..faf2a4a5b --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_hyperv_xen.yaml @@ -0,0 +1,9 @@ +- name: 'hypervisor:xen' + label: 'xen' + description: 'hypervisor:xen' + requires: + - name: 'hypervisor:qemu' + incompatible: + - name: 'hypervisor:vmware' + description: 'xen not compatible with vmware' + diff --git a/static/tests/functional/component_registry/plugin_conf/test_hyperv_xen_sun.yaml b/static/tests/functional/component_registry/plugin_conf/test_hyperv_xen_sun.yaml new file mode 100644 index 000000000..e5b0c2764 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_hyperv_xen_sun.yaml @@ -0,0 +1,14 @@ +- name: 'hypervisor:xen' + label: 'xen' + description: 'xen' + requires: + - name: 'additional_service:murano' + compatible: + - name: 'additional_service:ceilometer' + incompatible: + - name: 'hypervisor:test:*' + +- name: 'hypervisor:test:sun' + label: 'sun' +- name: 'hypervisor:test:rain' + label: 'rain' diff --git a/static/tests/functional/component_registry/plugin_conf/test_network_contr_binded.yaml b/static/tests/functional/component_registry/plugin_conf/test_network_contr_binded.yaml new file mode 100644 index 000000000..dd5281366 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_network_contr_binded.yaml @@ -0,0 +1,13 @@ +- name: 'network:neutron:contrail' + label: 'Contrail' + description: 'Contrail SDN networking' + bind: !!pairs + - 'cluster:net_provider': 'neutron' + - 'cluster:net_segment_type': 'tun' + compatible: + - name: 'hypervisor:*' + incompatible: + - name: 'hypervisor:vmware' + description: 'Contrail is not compatible with VMware for now' + - name: 'network:neutron:ml2:dvs' + description: 'Contrail is not compatible with VMware for now' diff --git a/static/tests/functional/component_registry/plugin_conf/test_network_ml2.yaml b/static/tests/functional/component_registry/plugin_conf/test_network_ml2.yaml new file mode 100644 index 000000000..07f33d3d2 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_network_ml2.yaml @@ -0,0 +1,8 @@ +- name: 'network:neutron:ml2:dvs' + label: 'DVS network' + description: 'DVS network type' + requires: + - name: 'network:neutron:core:ml2' + - name: 'hypervisor:vmware' + incompatible: + - name: 'network:neutron:core:contrail' diff --git a/static/tests/functional/component_registry/plugin_conf/test_network_ml2_frog.yaml b/static/tests/functional/component_registry/plugin_conf/test_network_ml2_frog.yaml new file mode 100644 index 000000000..70e104956 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_network_ml2_frog.yaml @@ -0,0 +1,25 @@ +- name: 'network:neutron:ml2:dvs' + label: 'DVS network' + description: 'DVS network type' + requires: + - name: 'network:neutron:core:ml2' + - name: 'hypervisor:vmware' +- name: 'network:neutron:ml2:frog' + label: 'frog' + description: 'frog' + incompatible: + - name: 'network:neutron:ml2:tun' + - name: 'storage:ephemeral:ceph' + requires: + - name: 'additional_service:sahara' + - name: 'network:neutron:core:ml2' + compatible: + - name: 'network:neutron:ml2:dvs' + - name: 'storage:block:ceph' + - name: 'hypervisor:libvirt:qemu' + - name: 'additional_service:murano' +- name: 'hypervisor:xen' + label: 'Xen' + description: 'Xen hypervisor' + incompatible: + - name: 'hypervisor:vmware' diff --git a/static/tests/functional/component_registry/plugin_conf/test_storage_block_nfs.yaml b/static/tests/functional/component_registry/plugin_conf/test_storage_block_nfs.yaml new file mode 100644 index 000000000..1123478fb --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_storage_block_nfs.yaml @@ -0,0 +1,14 @@ +- name: 'storage:block:nfs' + label: 'nfs' + description: 'nfs' + incompatible: + - name: 'storage:object:sheepdog' + message: 'not compatible with sheepdog' + - name: 'storage:object:cat' + message: 'not compatible with cat' +- name: 'storage:object:sheepdog' + label: 'sheepdog' + description: 'sheepdog' +- name: 'storage:object:cat' + label: 'cat' + description: 'cat' diff --git a/static/tests/functional/component_registry/plugin_conf/test_storage_block_zfs.yaml b/static/tests/functional/component_registry/plugin_conf/test_storage_block_zfs.yaml new file mode 100644 index 000000000..e6125d13c --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_storage_block_zfs.yaml @@ -0,0 +1,8 @@ +- name: 'storage:block:zfs' + label: 'zfs' + description: 'zfs' + incompatible: + - name: 'storage:image:nfs' +- name: 'storage:image:nfs' + label: 'nfs' + description: 'nfs' diff --git a/static/tests/functional/component_registry/plugin_conf/test_storage_image_swift.yaml b/static/tests/functional/component_registry/plugin_conf/test_storage_image_swift.yaml new file mode 100644 index 000000000..66e667284 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_storage_image_swift.yaml @@ -0,0 +1,5 @@ +- name: 'storage:image:swift' + label: 'swift' + description: 'swift' + incompatible: + - name: 'storage:image:ceph' diff --git a/static/tests/functional/component_registry/plugin_conf/test_storage_image_swift_cat.yaml b/static/tests/functional/component_registry/plugin_conf/test_storage_image_swift_cat.yaml new file mode 100644 index 000000000..c65f177f0 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_storage_image_swift_cat.yaml @@ -0,0 +1,10 @@ +- name: 'storage:image:swift' + label: 'swift' + description: 'swift' + incompatible: + - name: 'storage:image:ceph' + compatible: + - name: 'storage:image:cat' +- name: 'storage:image:cat' + label: 'cat' + description: 'cat' diff --git a/static/tests/functional/component_registry/plugin_conf/test_storage_object_cat.yaml b/static/tests/functional/component_registry/plugin_conf/test_storage_object_cat.yaml new file mode 100644 index 000000000..b2e9c6284 --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/test_storage_object_cat.yaml @@ -0,0 +1,5 @@ +- name: 'storage:object:cat' + label: 'Stor ceph' + description: 'stor ceph' + incompatible: + - name: 'storage:block:lvm' diff --git a/static/tests/functional/component_registry/plugin_conf/update_components.sh b/static/tests/functional/component_registry/plugin_conf/update_components.sh new file mode 100644 index 000000000..31bc76c6b --- /dev/null +++ b/static/tests/functional/component_registry/plugin_conf/update_components.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +default=${CONF_PATH}/$1.yaml +components_file=${CONF_PATH}/$2.yaml + +sudo sh -c "cat ${components_file} ${default} > ${PLUGIN_PATH}/components.yaml" + +fuel --os-username admin --os-password admin plugins --sync diff --git a/static/tests/functional/component_registry/test_additional.js b/static/tests/functional/component_registry/test_additional.js new file mode 100644 index 000000000..122f1897d --- /dev/null +++ b/static/tests/functional/component_registry/test_additional.js @@ -0,0 +1,207 @@ +/* + * Copyright 2016 Mirantis, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + +import registerSuite from 'intern!object'; +import Common from 'tests/functional/pages/common'; +import Modal from 'tests/functional/pages/modal'; +import 'tests/functional/helpers'; +import 'tests/functional/component_registry/component_helpers'; + +registerSuite(() => { + var common, modal; + + return { + name: 'Additional components', + setup() { + common = new Common(this.remote); + modal = new Modal(this.remote); + return this.remote + .then(() => common.getIn()); + }, + afterEach() { + return this.remote + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal) + .catch(() => modal.close().then(() => modal.waitToClose())); + }, + 'Test additional, -network, !vmware, !dvs, +Sahara'() { + var smile = 'input[value=additional_service\\:smile]'; + var ml2 = 'input[value=network\\:neutron\\:core\\:ml2]'; + var vlan = 'input[value=network\\:neutron\\:ml2\\:vlan]'; + + return this.remote + .updatePlugin('dvs_default test_addit_smile') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .clickByCssSelector('input[value=hypervisor\\:vmware]') + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + + //Check that smile is disabled when Nova network is enabled + .clickByCssSelector('input[value=network\\:nova_network]') + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .assertElementDisabled(smile, 'Smile checkbox is enabled with Nova network') + + .clickByCssSelector('button.prev-pane-btn') // back to Storage + .clickByCssSelector('button.prev-pane-btn') // back to Networking + + // Check that smile is disabled when dvs network is disabled + .clickByCssSelector(ml2) + .clickByCssSelector(vlan) + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .assertElementDisabled(smile, 'Smile checkbox is enabled without dvs network') + + .clickByCssSelector('button.prev-pane-btn') // back to Storage + .clickByCssSelector('button.prev-pane-btn') // back to Networking + + // Create cluster with vCenter + Neutron with ML2 plugin + dvs + Sahara + smile + .clickByCssSelector(ml2) + .clickByCssSelector(vlan) + .clickByCssSelector('input[value=network\\:neutron\\:ml2\\:dvs]') + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .clickByCssSelector('input[value=additional_service\\:sahara]') + .clickByCssSelector(smile) + .pressKeys('\uE007'); // Finish + }, + 'Test additional, -Ceilometer, !Murano, +Sahara'() { + var smile = 'input[value=additional_service\\:smile]'; + var ceilometer = 'input[value=additional_service\\:ceilometer]'; + + return this.remote + .updatePlugin('dvs_default test_addit_smile_ceil') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + + // Check that smile is disabled when Murano is not enabled (by default) + .assertElementDisabled(smile, 'Smile is enabled without Murano') + + // Check that smile is not compatible with Ceilometer + .clickByCssSelector('input[value=additional_service\\:murano]') // enable required Murano + .clickByCssSelector(ceilometer) + .assertElementDisabled(smile, 'Smile is enabled with Ceilometer') + .clickByCssSelector(ceilometer) // disable Ceilometer + .clickByCssSelector(smile) + .assertElementDisabled(ceilometer, 'Ceilometer is enabled with smile') + .assertElementsExist('i.tooltip-icon.glyphicon-warning-sign' + + '[data-original-title="Not compatible with smile"]', 1, + 'No warning that Ceilometer is not compatible with smile') + + // Create cluster with smile + murano + .pressKeys('\uE007'); // Finish + }, + 'Test additional, -Ironic, !Sahara, +Murano'() { + var smile = 'input[value=additional_service\\:smile]'; + var ironic = 'input[value=additional_service\\:ironic]'; + + return this.remote + .updatePlugin('dvs_default test_addit_smile_ironic') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + + // Check that smile is disabled when Sahara is not enabled (by default) + .assertElementDisabled(smile, 'Smile is enabled without Sahara') + + // Check that smile is not compatible with Ironic + .clickByCssSelector('input[value=additional_service\\:sahara]') // enable required Sahara + .clickByCssSelector(ironic) + .assertElementDisabled(smile, 'Smile is enabled with Ironic') + .clickByCssSelector(ironic) // disable Ironic + .clickByCssSelector(smile) + .assertElementDisabled(ironic, 'Ironic is enabled with smile') + .assertElementExists('i.tooltip-icon.glyphicon-warning-sign' + + '[data-original-title="Not compatible with smile"]', + 1, 'No warning that Ironic is incompatible with smile') + + // Create cluster with smile + Sahara + .pressKeys('\uE007'); // Finish + }, + 'Test additional, -ml2:tun, -vmware, !Sahara, +block:ceph'() { + var smile = 'input[value=additional_service\\:smile]'; + var vmware = 'input[value=hypervisor\\:vmware]'; + var vlan = 'input[value=network\\:neutron\\:ml2\\:vlan]'; + var tun = 'input[value=network\\:neutron\\:ml2\\:tun]'; + var sahara = 'input[value=additional_service\\:sahara]'; + + return this.remote + .updatePlugin('dvs_default test_addit_smile_sahara') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Check that smile is disabled when vCenter is enabled + .clickByCssSelector(vmware) + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .clickByCssSelector(sahara) + .assertElementDisabled(smile, 'Smile checkbox is enabled with vCenter') + + .clickByCssSelector('button.prev-pane-btn') // back to Storage + .clickByCssSelector('button.prev-pane-btn') // back to Networking + .clickByCssSelector('button.prev-pane-btn') // back to Compute + .clickByCssSelector(vmware) + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + + // Check that smile is disabled when Neutron with tunneling segmentation is enabled + .clickByCssSelector(vlan) + .clickByCssSelector(tun) + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .clickByCssSelector(sahara) + .assertElementDisabled(smile, 'Smile checkbox is enabled with tunneling segmentation') + + .clickByCssSelector('button.prev-pane-btn') // back to Storage + .clickByCssSelector('button.prev-pane-btn') // back to Networking + + // Create cluster with VLAN + Ceph Block Storage + Sahara + smile + .clickByCssSelector(tun) + .clickByCssSelector(vlan) + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .clickByCssSelector('input[value=storage\\:block\\:ceph]') + .pressKeys('\uE007') // Additional Services + .clickByCssSelector(sahara) + .clickByCssSelector(smile) + .pressKeys('\uE007'); // Finish + } + }; +}); diff --git a/static/tests/functional/component_registry/test_hypervisors.js b/static/tests/functional/component_registry/test_hypervisors.js new file mode 100644 index 000000000..8f5801b33 --- /dev/null +++ b/static/tests/functional/component_registry/test_hypervisors.js @@ -0,0 +1,241 @@ +/* + * Copyright 2016 Mirantis, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + +import registerSuite from 'intern!object'; +import Common from 'tests/functional/pages/common'; +import Modal from 'tests/functional/pages/modal'; +import 'tests/functional/helpers'; +import 'tests/functional/component_registry/component_helpers'; + +registerSuite(() => { + var common, modal; + + return { + name: 'Hypervisors', + setup() { + common = new Common(this.remote); + modal = new Modal(this.remote); + return this.remote + .then(() => common.getIn()); + }, + afterEach() { + return this.remote + .then(() => modal.close()) + .catch(() => true) + .then(() => modal.waitToClose()); + }, + 'Test description of components in wizard with qemu'() { + return this.remote + .updatePlugin('dvs_default test_hyperv_green_light_1') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .clickByCssSelector('input[value=hypervisor\\:vmware]') // Enable vcenter + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + + // Select Neutron with NSXv plugin and check that it has green light + .clickByCssSelector('input[value=network\\:neutron\\:core\\:nsx]') + .assertElementsExist('i.tooltip-icon.glyphicon-ok-sign[data-original-title=' + + '"The component was tested with all the selected components"]', + 2, 'Neutron with NSXv plugin has no green light'); + }, + 'Test description of components in wizard without qemu'() { + return this.remote + .updatePlugin('dvs_default test_hyperv_green_light_2') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .clickByCssSelector('input[value=hypervisor\\:vmware]') // enable vCenter + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + + // Select Neutron with NSXv plugin and check that it has green light + .clickByCssSelector('input[value=network\\:neutron\\:core\\:nsx]') + .assertElementsExist('i.tooltip-icon.glyphicon-info-sign[data-original-title=' + + '"This component was not tested with the following ' + + 'components: QEMU-KVM"]', 1, + 'Neutron with NSXv plugin has green light with QEMU-KVM'); + }, + 'Test hypervisor:libvirt, -xen'() { + var rain = 'input[name=hypervisor\\:libvirt\\:rain]'; + var xen = 'input[name=hypervisor\\:xen]'; + + return this.remote + .updatePlugin('dvs_default test_hyperv_rain') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Enable xen, check that rain is disabled + .clickByCssSelector(xen) + .assertElementDisabled(rain, 'Rain checkbox is enabled with xen') + + // Disable xen, enable rain, check that xen is disabled + .clickByCssSelector(xen) + .clickByCssSelector(rain) + .assertElementDisabled(xen, 'Xen checkbox is enabled with rain') + + // Create cluster with rain hypervisor + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Test hypervisor:libvirt, -qemu, -xen'() { + return this.remote + .updatePlugin('dvs_default test_hyperv_rain1') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Check that rain and xen hypervisors are displayed as checkboxes + .assertElementExists('input[name=hypervisor\\:xen][type="checkbox"]', + 'Xen is not displayed as a checkbox') + .assertElementExists('input[name=hypervisor\\:libvirt\\:rain1][type="checkbox"]', + 'Rain is not displayed as a checkbox'); + }, + 'Test hypervisor:libvirt, -qemu'() { + var sun = 'input[value=hypervisor\\:libvirt\\:sun]'; + var qemu = 'input[value=hypervisor\\:qemu]'; + + return this.remote + .updatePlugin('dvs_default test_hyperv_sun') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Check that sun hypervisor is disabled when qemu is enabled (by default) + .assertElementDisabled(sun, 'Sun checkbox is enabled with qemu') + + // Disable qemu, enable sun and check that qemu is disabled + .clickByCssSelector(qemu) + .clickByCssSelector(sun) + .assertElementDisabled(qemu, 'Qemu checkbox is enabled with sun') + + // Create cluster with sun hypervisor + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Test hypervisor, -vmware, !qemu'() { + var vmware = 'input[name=hypervisor\\:vmware]'; + var xen = 'input[name=hypervisor\\:xen]'; + + return this.remote + .updatePlugin('dvs_default test_hyperv_xen') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Enable vCenter and check that xen is disabled + .clickByCssSelector(vmware) + .assertElementDisabled(xen, 'Xen checkbox is enabled with vCenter') + + // Disable vCenter, enable xen and check that vCenter is disabled + .clickByCssSelector(vmware) + .clickByCssSelector(xen) + .assertElementDisabled(vmware, 'vCenter checkbox is enabled with xen') + + // Create cluster with xen hypervisor + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Test hypervisor, -hyperv*, !Murano, +Ceilometer'() { + var sun = 'input[value=hypervisor\\:test\\:sun]'; + var rain = 'input[value=hypervisor\\:test\\:rain]'; + var xen = 'input[value=hypervisor\\:xen]'; + + return this.remote + .updatePlugin('dvs_default test_hyperv_xen_sun') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Check that xen is not compatible with sun and rain hypervisors + .clickByCssSelector(sun) + .assertElementDisabled(xen, 'Xen checkbox is enabled with sun') + .clickByCssSelector(rain) + .assertElementDisabled(xen, 'Xen checkbox is enabled with sun + rain') + .clickByCssSelector(sun) + .assertElementDisabled(xen, 'Xen checkbox is enabled with rain') + .clickByCssSelector(rain) + + .clickByCssSelector(xen) + .assertElementDisabled(sun, 'Sun checkbox is enabled with xen') + .assertElementDisabled(rain, 'Rain checkbox is enabled with xen') + + // Try to create cluster with xen without Murano + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + .assertElementTextEquals('div.text-error', 'Component \'hypervisor:xen\' requires ' + + 'any of components from [u\'additional_service:murano\'] set.', + 'Error was not displayed'); + }, + 'Test create cluster with xen + Murano + Ceilometer'() { + return this.remote + .updatePlugin('dvs_default test_hyperv_xen_sun') + .newClusterFillName(modal) + + // Create cluster with xen + Murano + Ceilometer + .pressKeys('\uE007') // go to Compute + .clickByCssSelector('input[value=hypervisor\\:xen]') + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .clickByCssSelector('input[value=additional_service\\:murano]') + .clickByCssSelector('input[value=additional_service\\:ceilometer]') + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + } + }; +}); diff --git a/static/tests/functional/component_registry/test_networking.js b/static/tests/functional/component_registry/test_networking.js new file mode 100644 index 000000000..246c25177 --- /dev/null +++ b/static/tests/functional/component_registry/test_networking.js @@ -0,0 +1,258 @@ +/* + * Copyright 2016 Mirantis, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + +import registerSuite from 'intern!object'; +import Common from 'tests/functional/pages/common'; +import Modal from 'tests/functional/pages/modal'; +import 'tests/functional/helpers'; +import 'tests/functional/component_registry/component_helpers'; + +registerSuite(() => { + var common, modal; + + return { + name: 'Networking', + setup() { + common = new Common(this.remote); + modal = new Modal(this.remote); + return this.remote + .then(() => common.getIn()); + }, + afterEach() { + return this.remote + .then(() => modal.close()) + .catch(() => true) + .then(() => modal.waitToClose()); + }, + 'Test network, -vmware, -dvs, +hyperv*, bind:tun'() { + var vmware = 'input[name=hypervisor\\:vmware]'; + var contrail = 'input[value=network\\:neutron\\:contrail]'; + + return this.remote + .updatePlugin('dvs_default test_network_contr_binded') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Check that Contrail is disabled when vCenter is enabled + .clickByCssSelector(vmware) + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + // Go back to Compute and disable vCenter + .clickByCssSelector('.prev-pane-btn') + .clickByCssSelector(vmware) + + // Create cluster with qemu + Contrail network + ceph + Sahara + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .clickByCssSelector(contrail) + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .clickByCssSelector('input[value=storage\\:block\\:ceph]') + .pressKeys('\uE007') // Additional Services + .clickByCssSelector('input[value=additional_service\\:sahara]') + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Check that all network configuration of neutron tun is available in Network tab + .clickByCssSelector('a.network.cluster-tab') + .assertElementTextEquals('.title .segmentation-type', + '(Neutron with tunneling segmentation)', + 'No tunneling segmentation message') + + // Back to Dashboard and delete created environment + .clickByCssSelector('a.dashboard.cluster-tab') + .deleteCluster(modal); + }, + 'Create cluster with vCenter + dvs network'() { + return this.remote + .updatePlugin('dvs_default test_network_contr_binded') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Create cluster with vCenter + dvs network + .clickByCssSelector('input[name=hypervisor\\:vmware]') + .assertNextButtonEnabled() + .pressKeys('\uE007') // go to Networking + .clickByCssSelector('input[value=network\\:neutron\\:ml2\\:dvs]') + + // Create env with vCenter + nsxv + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Test that it is not possibility to create cluster with nsx + dvs'() { + return this.remote + .updatePlugin('dvs_default nsxv_default') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .clickByCssSelector('input[name=hypervisor\\:vmware]') // enable vCenter + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + + // Check that there is no possibility to select multiple networks neutron:nsx and + // neutron:ml2:dvs (choose nsxv, then ml2 + vlan + dvs) + .clickByCssSelector('input[value=network\\:neutron\\:core\\:nsx]') + .clickByCssSelector('input[value=network\\:neutron\\:core\\:ml2]') + .clickByCssSelector('input[name=network\\:neutron\\:ml2\\:vlan]') + .clickByCssSelector('input[name=network\\:neutron\\:ml2\\:dvs]') + + // Create env with vCenter + ml2 + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Create cluster with neutron:nsx'() { + return this.remote + .updatePlugin('dvs_default nsxv_default') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .clickByCssSelector('input[name=hypervisor\\:vmware]') // enable vCenter + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + + // Check that there is no possibility to select multiple networks neutron:nsx and + // neutron:ml2:dvs (choose nsxv) + .clickByCssSelector('input[value=network\\:neutron\\:core\\:nsx]') + + // Create env with vCenter + nsxv + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Test network, -contrail, !ml2, !vmware'() { + return this.remote + .updatePlugin('contrail_default test_network_ml2') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + + // Check in wizard that network contrail is blocked when dvs network is selected + // (choose contrail) + .clickByCssSelector('input[value=network\\:neutron\\:contrail]') + + // Create cluster with contrail + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Test network, -tun, -e:ceph, !Sahara, !ml2, +dvs, +b:ceph, +qemu, +Murano'() { + var vmware = 'input[value=hypervisor\\:vmware]'; + var xen = 'input[value=hypervisor\\:xen]'; + var vlan = 'input[value=network\\:neutron\\:ml2\\:vlan]'; + var tun = 'input[value=network\\:neutron\\:ml2\\:tun]'; + var frog = 'input[value=network\\:neutron\\:ml2\\:frog]'; + + return this.remote + .updatePlugin('dvs_default test_network_ml2_frog') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Check that xen is incompatible with vCenter + .clickByCssSelector(vmware) + .assertElementDisabled(xen, 'Xen is enabled with vCenter') + .clickByCssSelector(vmware) + .clickByCssSelector(xen) + .assertElementDisabled(vmware, 'vCenter is enabled with xen') + .clickByCssSelector(xen) + + // Check that frog is disabled with ml2:tun + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .clickByCssSelector(vlan) + .clickByCssSelector(tun) + .assertElementDisabled(frog, 'frog is enabled with tun') + .clickByCssSelector(tun) + .clickByCssSelector(vlan) + + // Create cluster with KVM + vCenter, frog + DVS network, Sahara + Murano + .clickByCssSelector('button.prev-pane-btn') // back to Compute + .clickByCssSelector(vmware) + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .clickByCssSelector('input[value=network\\:neutron\\:ml2\\:dvs]') + .clickByCssSelector(frog) + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .assertElementDisabled('input[value=storage\\:ephemeral\\:ceph]', + 'Ephemerap Ceph is enabled with frog') + .pressKeys('\uE007') // Additional Services + .clickByCssSelector('input[value=additional_service\\:sahara]') + .clickByCssSelector('input[value=additional_service\\:murano]') + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Test create cluster without required Sahara'() { + return this.remote + .updatePlugin('dvs_default test_network_ml2_frog') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Try to create cluster with KVM + vCenter hypervisors, frog + DVS network + // without Sahara additional service (should not be created) + .clickByCssSelector('input[value=hypervisor\\:vmware]') + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .clickByCssSelector('input[value=network\\:neutron\\:ml2\\:frog]') + .clickByCssSelector('input[value=network\\:neutron\\:ml2\\:dvs]') + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + .assertElementTextEquals('.text-error', 'Component \'network:neutron:ml2:frog\' ' + + 'requires any of components from [u\'additional_service:' + + 'sahara\'] set.', 'Error was not displayed'); + } + }; +}); diff --git a/static/tests/functional/component_registry/test_storage.js b/static/tests/functional/component_registry/test_storage.js new file mode 100644 index 000000000..6d6c3de2e --- /dev/null +++ b/static/tests/functional/component_registry/test_storage.js @@ -0,0 +1,192 @@ +/* + * Copyright 2016 Mirantis, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + +import registerSuite from 'intern!object'; +import Common from 'tests/functional/pages/common'; +import Modal from 'tests/functional/pages/modal'; +import 'tests/functional/helpers'; +import 'tests/functional/component_registry/component_helpers'; + +registerSuite(() => { + var common, modal; + + return { + name: 'Storage', + setup() { + common = new Common(this.remote); + modal = new Modal(this.remote); + return this.remote + .then(() => common.getIn()); + }, + afterEach() { + return this.remote + .then(() => modal.close()) + .catch(() => true) + .then(() => modal.waitToClose()); + }, + 'Test storage, -object'() { + var nfs = 'input[value=storage\\:block\\:nfs]'; + var cat = 'input[value=storage\\:object\\:cat]'; + var sheepdog = 'input[value=storage\\:object\\:sheepdog]'; + + return this.remote + .updatePlugin('dvs_default test_storage_block_nfs') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + + // Check that cat and sheepdog are disabled when nfs is enabled + .clickByCssSelector(nfs) + .assertElementDisabled(cat, 'Cat checkbox is enabled with nfs') + .assertElementDisabled(sheepdog, 'Sheepdog checkbox is enabled with nfs') + + // Check that nfs is disabled when cat and sheepdog are enabled + .clickByCssSelector(nfs) + .clickByCssSelector(cat) + .assertElementDisabled(nfs, 'Nfs checkbox is enabled with cat') + .clickByCssSelector(sheepdog) + .assertElementDisabled(nfs, 'Nfs checkbox is enabled with sheepdog') + .clickByCssSelector(cat) + .clickByCssSelector(sheepdog) + + // Create cluster with nfs Block Storage + .clickByCssSelector(nfs) + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal).sleep(10000); + }, + 'Test storage -storage:image'() { + var nfs = 'input[value=storage\\:image\\:nfs]'; + var zfs = 'input[value=storage\\:block\\:zfs]'; + + return this.remote + .updatePlugin('dvs_default test_storage_block_zfs') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + + // Check that zfs block storage is disabled when nfs image storage enabled + .clickByCssSelector(nfs) + .assertElementDisabled(zfs, 'Zfs checkbox is enabled with nfs') + + // Check that nfs image storage is disabled when zfs block storage enabled + .clickByCssSelector(nfs) // disable nfs + .clickByCssSelector(zfs) + .assertElementDisabled(nfs, 'Nfs checkbox is enabled with zfs') + + // Create cluster with zfs + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Test storage:image, -image:ceph'() { + var swift = 'input[value=storage\\:image\\:swift]'; + var ceph = 'input[value=storage\\:image\\:ceph]'; + + return this.remote + .updatePlugin('dvs_default test_storage_image_swift') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + + // Check that Ceph image storage is inactive when swift image storage is + // active and vice versa + .clickByCssSelector(swift) + .assertElementPropertyEquals(ceph, 'checked', false, 'Ceph is enabled with swift') + .clickByCssSelector(ceph) + .assertElementPropertyEquals(swift, 'checked', false, 'Swift is enabled with ceph'); + }, + 'Test storage:image, -image:ceph, +storage:image'() { + var ceph = 'input[value=storage\\:image\\:ceph]'; + var swift = 'input[value=storage\\:image\\:swift]'; + + return this.remote + .updatePlugin('dvs_default test_storage_image_swift_cat') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + + // Check that Ceph image storage is inactive when swift image storage is + // active and vice versa + .clickByCssSelector('input[value=storage\\:image\\:cat]') + .clickByCssSelector(ceph) + .assertElementDisabled(swift, 'Swift is enabled with ceph') + .clickByCssSelector(ceph) // disable Ceph + .clickByCssSelector(swift) + .assertElementDisabled(ceph, 'Ceph is enabled with swift') + + // Create cluster with qemu + Neutron vlan + Swift + cat + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + }, + 'Test storage:object, -block:lvm'() { + var cat = 'input[value=storage\\:object\\:cat]'; + + return this.remote + .updatePlugin('dvs_default test_storage_object_cat') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + + // Check that cat is disabled when LVM is enabled (by default) + .assertElementDisabled(cat, 'cat is enabled with LVM') + + // Create cluster with Ceph block storage + Stor ceph + .clickByCssSelector('input[value=storage\\:block\\:ceph]') + .clickByCssSelector(cat) + .pressKeys('\uE007') // Additional Services + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Delete created environment + .deleteCluster(modal); + } + }; +}); diff --git a/static/tests/functional/component_registry/test_ui_components.js b/static/tests/functional/component_registry/test_ui_components.js new file mode 100644 index 000000000..19166933e --- /dev/null +++ b/static/tests/functional/component_registry/test_ui_components.js @@ -0,0 +1,101 @@ +/* + * Copyright 2016 Mirantis, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + +import registerSuite from 'intern!object'; +import Common from 'tests/functional/pages/common'; +import Modal from 'tests/functional/pages/modal'; +import 'tests/functional/helpers'; +import 'tests/functional/component_registry/component_helpers'; + +registerSuite(() => { + var common, modal; + + return { + name: 'UI components', + setup() { + common = new Common(this.remote); + modal = new Modal(this.remote); + return this.remote + .then(() => common.getIn()); + }, + 'Test that all components, chosen in Wizard tab, are enabled on Setting tab'() { + return this.remote + .updatePlugin('dvs_default contrail_default') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Create cluster with all compatible elements in wizard + .clickByCssSelector('input[value=hypervisor\\:vmware]') // vCenter + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .clickByCssSelector('input[value=network\\:neutron\\:ml2\\:dvs]') // VMware DVS + .assertNextButtonEnabled() + .pressKeys('\uE007') // Storage + .clickByCssSelector('input[value=storage\\:image\\:ceph]') // image Ceph + .clickByCssSelector('input[value=storage\\:object\\:ceph]') // object Ceph + .clickByCssSelector('input[value=storage\\:ephemeral\\:ceph]') // ephemeral Ceph + .pressKeys('\uE007') // Additional Services + .clickByCssSelector('input[value=additional_service\\:sahara]') // Sahara + .clickByCssSelector('input[value=additional_service\\:murano]') // Murano + .clickByCssSelector('input[value=additional_service\\:ceilometer]') // Ceilometer + .clickByCssSelector('input[value=additional_service\\:ironic]') // Ironic + .pressKeys('\uE007') // Finish + .pressKeys('\uE007') // Create + .then(() => modal.waitToClose()) + + // Check that all components, chosen in Wizard tab, are enabled on Setting tab + .clickByCssSelector('a.settings.cluster-tab') + .clickByCssSelector('a.subtab-link-storage') + .assertElementPropertyEquals('input[name=images_ceph]', 'checked', true, + 'image Ceph is disabled') // image Ceph + .assertElementPropertyEquals('input[name=objects_ceph]', 'checked', true, + 'object Ceph is disabled') // object Ceph + .assertElementPropertyEquals('input[name=ephemeral_ceph]', 'checked', true, + 'ephemeral Ceph is disabled') // ephemeral Ceph + .clickByCssSelector('a.subtab-link-openstack_services') + .assertElementPropertyEquals('input[name=sahara]', 'checked', true, + 'Sahara is disabled') // Sahara + .assertElementPropertyEquals('input[name=murano]', 'checked', true, + 'Murano is disabled') // Murano + .assertElementPropertyEquals('input[name=ceilometer]', 'checked', true, + 'Ceilometer is disabled') // Ceilometer + .assertElementPropertyEquals('input[name=ironic]', 'checked', true, + 'Ironic is disabled') // Ironic + .assertElementExists('a.vmware.cluster-tab', + 'VMware tab is not presented') // vCenter + + // Delete created environment + .clickByCssSelector('a.dashboard.cluster-tab') + .deleteCluster(modal); + }, + 'Test that when vcenter is selected as compute, contrail should be turned off'() { + return this.remote + .updatePlugin('dvs_default contrail_default') + .newClusterFillName(modal) + + .pressKeys('\uE007') // go to Compute + + // Check that contrail is disabled when vCenter is enabled + .clickByCssSelector('input[value=hypervisor\\:vmware]') + .assertNextButtonEnabled() + .pressKeys('\uE007') // Networking + .assertElementDisabled('input[value=network\\:neutron\\:contrail]', + 'Contrail checkbox is enabled with vCenter') + .then(() => modal.waitToClose()); + } + }; +});