Add a runner for contrail-test Juniper tests
- add steps in tcp_tests/templates/opencontrail to prepare tests
- add a fixture and a test runner 'test_opencontrail' that gets
the two variables from environment to pass them to test runner:
export OPENCONTRAIL_TAGS=smoke
export OPENCONTRAIL_FEATURES=neutron
- fix docstrings for fixtures
- add print of the environment variables that can be used in tests
and current defaults (taking into account the exported variables)
diff --git a/tcp_tests/fixtures/common_services_fixtures.py b/tcp_tests/fixtures/common_services_fixtures.py
index 4a4ee1d..ed00574 100644
--- a/tcp_tests/fixtures/common_services_fixtures.py
+++ b/tcp_tests/fixtures/common_services_fixtures.py
@@ -27,13 +27,11 @@
@pytest.fixture(scope='function')
def common_services_actions(config, underlay):
- """Fixture that provides various actions for K8S
+ """Fixture that provides various actions for CommonServices
:param config: fixture provides oslo.config
:param underlay: fixture provides underlay manager
- :rtype: K8SManager
-
- For use in tests or fixtures to deploy a custom K8S
+ :rtype: CommonServicesManager
"""
return common_services_manager.CommonServicesManager(config, underlay)
@@ -42,27 +40,32 @@
def common_services_deployed(revert_snapshot, request, config,
hardware, underlay, salt_deployed,
common_services_actions):
- """Fixture to get or install TCP on environment
+ """Fixture to get or install common services on the environment
+ :param revert_snapshot: fixture that reverts snapshot that is specified
+ in test with @pytest.mark.revert_snapshot(<name>)
:param request: fixture provides pytest data
:param config: fixture provides oslo.config
:param hardware: fixture provides enviromnet manager
:param underlay: fixture provides underlay manager
- :param tcp_actions: fixture provides TCPManager instance
- :rtype: TCPManager
+ :param common_services_actions: fixture provides CommonServicesManager
+ instance
+ :rtype: CommonServicesManager
- If config.tcp.tcp_host is not set, this fixture assumes that
- the tcp cluster was not deployed, and do the following:
- - deploy tcp cluster
- - make snapshot with name 'tcp_deployed'
- - return TCPCluster instance
+ If config.common_services.common_services_installed is not set, this
+ fixture assumes that the common services were not installed
+ , and do the following:
+ - install common services
+ - make snapshot with name 'common_services_deployed'
+ - return CommonServicesManager
- If config.tcp.tcp_host was set, this fixture assumes that the tcp
- cluster was already deployed, and do the following:
- - return TCPCluster instance
+ If config.common_services.common_services_installed was set, this fixture
+ assumes that the common services were already installed, and do
+ the following:
+ - return CommonServicesManager instance
- If you want to revert 'tcp_deployed' snapshot, please use mark:
- @pytest.mark.revert_snapshot("tcp_deployed")
+ If you want to revert 'common_services_deployed' snapshot, please use mark:
+ @pytest.mark.revert_snapshot("common_services_deployed")
"""
# If no snapshot was reverted, then try to revert the snapshot
# that belongs to the fixture.
@@ -74,7 +77,7 @@
hardware.revert_snapshot(ext.SNAPSHOT.common_services_deployed)
# Create Salt cluster
- if not config.common_services.installed:
+ if not config.common_services.common_services_installed:
steps_path = config.common_services_deploy.common_services_steps_path
with underlay.yaml_editor(steps_path) as commands:
common_services_actions.install(commands.content)
diff --git a/tcp_tests/fixtures/opencontrail_fixtures.py b/tcp_tests/fixtures/opencontrail_fixtures.py
new file mode 100644
index 0000000..a00acc7
--- /dev/null
+++ b/tcp_tests/fixtures/opencontrail_fixtures.py
@@ -0,0 +1,32 @@
+# 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 pytest
+
+from tcp_tests.managers import opencontrail_manager
+
+
+@pytest.fixture(scope='function')
+def opencontrail(config, underlay, openstack_deployed):
+ """Fixture that provides various actions for OpenContrail
+
+ :param config: fixture provides oslo.config
+ :param underlay: fixture provides underlay manager
+ :rtype: OpenContrailManager
+
+ """
+ return opencontrail_manager.OpenContrailManager(config, underlay,
+ openstack_deployed)
+
diff --git a/tcp_tests/fixtures/openstack_fixtures.py b/tcp_tests/fixtures/openstack_fixtures.py
index 48e9125..c7e648e 100644
--- a/tcp_tests/fixtures/openstack_fixtures.py
+++ b/tcp_tests/fixtures/openstack_fixtures.py
@@ -42,27 +42,29 @@
def openstack_deployed(revert_snapshot, request, config,
hardware, underlay, common_services_deployed,
openstack_actions):
- """Fixture to get or install TCP on environment
+ """Fixture to get or install OpenStack services on environment
+ :param revert_snapshot: fixture that reverts snapshot that is specified
+ in test with @pytest.mark.revert_snapshot(<name>)
:param request: fixture provides pytest data
:param config: fixture provides oslo.config
:param hardware: fixture provides enviromnet manager
:param underlay: fixture provides underlay manager
- :param tcp_actions: fixture provides TCPManager instance
- :rtype: TCPManager
+ :param tcp_actions: fixture provides OpenstackManager instance
+ :rtype: OpenstackManager
- If config.tcp.tcp_host is not set, this fixture assumes that
- the tcp cluster was not deployed, and do the following:
- - deploy tcp cluster
- - make snapshot with name 'tcp_deployed'
- - return TCPCluster instance
+ If config.openstack.openstack_installed is not set, this fixture assumes
+ that the openstack services were not installed, and do the following:
+ - install openstack services
+ - make snapshot with name 'openstack_deployed'
+ - return OpenstackManager instance
- If config.tcp.tcp_host was set, this fixture assumes that the tcp
- cluster was already deployed, and do the following:
- - return TCPCluster instance
+ If config.openstack.openstack_installed was set, this fixture assumes that
+ the openstack services were already installed, and do the following:
+ - return OpenstackManager instance
- If you want to revert 'tcp_deployed' snapshot, please use mark:
- @pytest.mark.revert_snapshot("tcp_deployed")
+ If you want to revert 'openstack_deployed' snapshot, please use mark:
+ @pytest.mark.revert_snapshot("openstack_deployed")
"""
# If no snapshot was reverted, then try to revert the snapshot
# that belongs to the fixture.
@@ -73,7 +75,7 @@
hardware.revert_snapshot(ext.SNAPSHOT.openstack_deployed)
# Create Salt cluster
- if not config.openstack.installed:
+ if not config.openstack.openstack_installed:
steps_path = config.openstack_deploy.openstack_steps_path
with underlay.yaml_editor(steps_path) as commands:
openstack_actions.install(commands.content)
diff --git a/tcp_tests/fixtures/salt_fixtures.py b/tcp_tests/fixtures/salt_fixtures.py
index e22b16f..047f106 100644
--- a/tcp_tests/fixtures/salt_fixtures.py
+++ b/tcp_tests/fixtures/salt_fixtures.py
@@ -27,13 +27,11 @@
@pytest.fixture(scope='function')
def salt_actions(config, underlay):
- """Fixture that provides various actions for K8S
+ """Fixture that provides various actions for salt
:param config: fixture provides oslo.config
:param underlay: fixture provides underlay manager
- :rtype: K8SManager
-
- For use in tests or fixtures to deploy a custom K8S
+ :rtype: SaltManager
"""
return saltmanager.SaltManager(config, underlay)
@@ -41,27 +39,29 @@
@pytest.fixture(scope='function')
def salt_deployed(revert_snapshot, request, config,
hardware, underlay, salt_actions):
- """Fixture to get or install TCP on environment
+ """Fixture to get or install salt service on environment
+ :param revert_snapshot: fixture that reverts snapshot that is specified
+ in test with @pytest.mark.revert_snapshot(<name>)
:param request: fixture provides pytest data
:param config: fixture provides oslo.config
:param hardware: fixture provides enviromnet manager
:param underlay: fixture provides underlay manager
- :param tcp_actions: fixture provides TCPManager instance
- :rtype: TCPManager
+ :param salt_actions: fixture provides SaltManager instance
+ :rtype: SaltManager
- If config.tcp.tcp_host is not set, this fixture assumes that
- the tcp cluster was not deployed, and do the following:
- - deploy tcp cluster
- - make snapshot with name 'tcp_deployed'
- - return TCPCluster instance
+ If config.salt.salt_master_host is not set, this fixture assumes that
+ the salt was not installed, and do the following:
+ - install salt master and salt minions
+ - make snapshot with name 'salt_deployed'
+ - return SaltManager
- If config.tcp.tcp_host was set, this fixture assumes that the tcp
- cluster was already deployed, and do the following:
- - return TCPCluster instance
+ If config.salt.salt_master_host was set, this fixture assumes that the
+ salt was already deployed, and do the following:
+ - return SaltManager instance
- If you want to revert 'tcp_deployed' snapshot, please use mark:
- @pytest.mark.revert_snapshot("tcp_deployed")
+ If you want to revert 'salt_deployed' snapshot, please use mark:
+ @pytest.mark.revert_snapshot("salt_deployed")
"""
# If no snapshot was reverted, then try to revert the snapshot
# that belongs to the fixture.