Merge "Fix fixtures order for influxdb failover tests"
diff --git a/tcp_tests/managers/sl_manager.py b/tcp_tests/managers/sl_manager.py
index f65f524..1a97737 100644
--- a/tcp_tests/managers/sl_manager.py
+++ b/tcp_tests/managers/sl_manager.py
@@ -37,9 +37,8 @@
super(SLManager, self).__init__(
config=config, underlay=underlay)
- def install(self, commands):
- self.execute_commands(commands,
- label='Install SL services')
+ def install(self, commands, label='Install SL services'):
+ self.execute_commands(commands, label=label)
self.__config.stack_light.sl_installed = True
self.__config.stack_light.sl_vip_host = self.get_sl_vip()
diff --git a/tcp_tests/settings_oslo.py b/tcp_tests/settings_oslo.py
index 293e1cc..d42b444 100644
--- a/tcp_tests/settings_oslo.py
+++ b/tcp_tests/settings_oslo.py
@@ -224,6 +224,8 @@
sl_opts = [
ct.Cfg('sl_installed', ct.Boolean(),
help="", default=False),
+ ct.Cfg('sl_version', ct.String(),
+ help="StackLight version. Could be 1 or 2", default=''),
ct.Cfg('sl_vip_host', ct.IPAddress(),
help="Vip address for SL services", default='0.0.0.0'),
ct.Cfg('sl_prometheus_port', ct.String(),
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index 955972c..1cb8a8c 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -35,6 +35,9 @@
{% set SALT_FORMULAS_REFS = os_env('SALT_FORMULAS_REFS', '') %}
{% set SALT_FORMULAS_REPO = os_env('SALT_FORMULAS_REPO', 'https://gerrit.mcp.mirantis.net/salt-formulas') %}
+# Needed for using different models in different templates
+{% set CLUSTER_NAME = os_env('DOMAIN_NAME', LAB_CONFIG_NAME) %}
+
{%- macro MACRO_INSTALL_SALT_MASTER() %}
{######################################}
@@ -144,7 +147,7 @@
# Disable checkouting the model from remote repository
cat << 'EOF' >> /srv/salt/reclass/nodes/_generated/{{ HOSTNAME_CFG01 }}.yml
classes:
- - cluster.{{ LAB_CONFIG_NAME }}.infra.config
+ - cluster.{{ CLUSTER_NAME }}.infra.config
parameters:
_param:
linux_system_codename: xenial
@@ -677,7 +680,7 @@
exec > >(tee -i /tmp/cloud-init-bootstrap.log) 2>&1
export network01_prefix={{ IPV4_NET_ADMIN_PREFIX }}
export network02_prefix={{ IPV4_NET_CONTROL_PREFIX }}
- export cluster_name={{ LAB_CONFIG_NAME }}
+ export cluster_name={{ CLUSTER_NAME }}
export config_host={{ config.salt.salt_master_host }}
export node_domain={{ DOMAIN_NAME }}
export nodes_os="xenial"
diff --git a/tcp_tests/templates/virtual-mcp11-k8s-calico/salt.yaml b/tcp_tests/templates/virtual-mcp11-k8s-calico/salt.yaml
index 45ffc37..43e609f 100644
--- a/tcp_tests/templates/virtual-mcp11-k8s-calico/salt.yaml
+++ b/tcp_tests/templates/virtual-mcp11-k8s-calico/salt.yaml
@@ -5,6 +5,9 @@
{% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %}
# Other salt model repository parameters see in shared-salt.yaml
+{% set ENABLE_COMPUTES_SELF_REGISTER = os_env('ENABLE_COMPUTES_SELF_REGISTER', '') %}
+# Different templates using this mechanism.
+
{% import 'shared-salt.yaml' as SHARED with context %}
{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
@@ -19,6 +22,10 @@
{{ SHARED.ADJUST_K8S_OPTS() }}
+{%- if ENABLE_COMPUTES_SELF_REGISTER != '' %}
+{{ SHARED.REGISTER_COMPUTE_NODES() }}
+{%- endif %}
+
{{ SHARED.MACRO_GENERATE_INVENTORY() }}
{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
diff --git a/tcp_tests/templates/virtual-mcp11-k8s-contrail/salt.yaml b/tcp_tests/templates/virtual-mcp11-k8s-contrail/salt.yaml
index c6e1486..0062db5 100644
--- a/tcp_tests/templates/virtual-mcp11-k8s-contrail/salt.yaml
+++ b/tcp_tests/templates/virtual-mcp11-k8s-contrail/salt.yaml
@@ -5,6 +5,10 @@
{% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %}
# Other salt model repository parameters see in shared-salt.yaml
+
+{% set ENABLE_COMPUTES_SELF_REGISTER = os_env('ENABLE_COMPUTES_SELF_REGISTER', '') %}
+# Different templates using this mechanism.
+
{% import 'shared-salt.yaml' as SHARED with context %}
{{ SHARED.MACRO_INSTALL_SALT_MASTER() }}
@@ -19,6 +23,10 @@
{{ SHARED.ADJUST_K8S_OPTS() }}
+{%- if ENABLE_COMPUTES_SELF_REGISTER != '' %}
+{{ SHARED.REGISTER_COMPUTE_NODES() }}
+{%- endif %}
+
{{ SHARED.MACRO_GENERATE_INVENTORY() }}
{{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
diff --git a/tcp_tests/tests/system/test_upgrade_stacklight.py b/tcp_tests/tests/system/test_upgrade_stacklight.py
new file mode 100644
index 0000000..eec3fcd
--- /dev/null
+++ b/tcp_tests/tests/system/test_upgrade_stacklight.py
@@ -0,0 +1,69 @@
+# 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.
+
+from tcp_tests import logger
+from tcp_tests import settings
+import pytest
+LOG = logger.logger
+
+
+@pytest.mark.deploy
+class TestUpgradeStacklight(object):
+
+ """Test class for testing OpenContrail on a TCP lab"""
+ @pytest.mark.grab_versions
+ @pytest.mark.fail_snapshot
+ def test_upgrade_stacklight(self, underlay, config,
+ hardware, sl_actions, sl_deployed):
+ """Runner
+
+ Scenario:
+ 1. Prepare salt on hosts
+ 2. Setup controller nodes
+ 3. Setup compute nodes
+ 4. Prepare tests
+ 5. Run tests
+ """
+# Upgrade SL
+ lab_name = settings.LAB_CONFIG_NAME
+ steps_path = 'templates/{0}/sl-upgrade.yaml'.format(lab_name)
+ commands = underlay.read_template(steps_path)
+ sl_actions.install(commands, label='Upgrade SL services')
+ hardware.create_snapshot(name='sl_v1_upgraded')
+
+# Workaround for keepalived hang issue after env revert from snapshot
+# see https://mirantis.jira.com/browse/PROD-12038
+ LOG.warning('Restarting keepalived service on controllers...')
+ sl_actions._salt.local(tgt='ctl*', fun='cmd.run',
+ args='systemctl restart keepalived.service')
+ LOG.warning('Restarting keepalived service on mon nodes...')
+ sl_actions._salt.local(tgt='mon*', fun='cmd.run',
+ args='systemctl restart keepalived.service')
+
+ mon_nodes = sl_deployed.get_monitoring_nodes()
+ LOG.debug('Mon nodes list {0}'.format(mon_nodes))
+
+
+# Run SL component tetsts
+ sl_deployed.run_sl_functional_tests(
+ 'cfg01',
+ '/root/stacklight-pytest/stacklight_tests/',
+ 'tests',
+ 'tests/prometheus')
+
+# Download report
+ sl_deployed.download_sl_test_report(
+ 'cfg01',
+ '/root/stacklight-pytest/stacklight_tests/report.xml')
+ LOG.info("*************** DONE **************")