Added 'k8s_deployed' fixture
Created a separate fixture for Kubernetes deployment.
Modified existing k8s related fixtures / tests so they
use it now and updated templates with k8s environments.
Also this patch includes few minor changes:
* removed unused fixture 'deploy_openstack' which
was a full copy of 'openstack_deployed' fixture;
* removed unused modules imports;
* fixed typos and docstrings.
Change-Id: Ic35551f3e52913cede753b92e7d5a81f54570b01
Reviewed-on: https://review.gerrithub.io/365234
Reviewed-by: <vrovachev@mirantis.com>
Reviewed-by: Dennis Dmitriev <dis.xcom@gmail.com>
Tested-by: Tatyanka Leontovich <tleontovich@mirantis.com>
diff --git a/tcp_tests/fixtures/openstack_fixtures.py b/tcp_tests/fixtures/openstack_fixtures.py
index f69c247..ae3b9e8 100644
--- a/tcp_tests/fixtures/openstack_fixtures.py
+++ b/tcp_tests/fixtures/openstack_fixtures.py
@@ -28,13 +28,14 @@
@pytest.fixture(scope='function')
def openstack_actions(config, underlay, salt_deployed):
- """Fixture that provides various actions for K8S
+ """Fixture that provides various actions for OpenStack
:param config: fixture provides oslo.config
:param underlay: fixture provides underlay manager
- :rtype: K8SManager
+ :param salt_deployed: fixture provides salt manager
+ :rtype: OpenstackManager
- For use in tests or fixtures to deploy a custom K8S
+ For use in tests or fixtures to deploy a custom OpenStack
"""
return openstack_manager.OpenstackManager(config, underlay, salt_deployed)
@@ -52,7 +53,8 @@
:param config: fixture provides oslo.config
:param hardware: fixture provides enviromnet manager
:param underlay: fixture provides underlay manager
- :param tcp_actions: fixture provides OpenstackManager instance
+ :param common_services_deployed: fixture provides CommonServicesManager
+ :param openstack_actions: fixture provides OpenstackManager instance
:rtype: OpenstackManager
If config.openstack.openstack_installed is not set, this fixture assumes
@@ -68,54 +70,7 @@
If you want to revert 'openstack_deployed' snapshot, please use mark:
@pytest.mark.revert_snapshot("openstack_deployed")
"""
- # Create Salt cluster
- if not config.openstack.openstack_installed:
- steps_path = config.openstack_deploy.openstack_steps_path
- commands = underlay.read_template(steps_path)
- openstack_actions.install(commands)
- hardware.create_snapshot(ext.SNAPSHOT.openstack_deployed)
-
- else:
- # 1. hardware environment created and powered on
- # 2. config.underlay.ssh contains SSH access to provisioned nodes
- # (can be passed from external config with TESTS_CONFIGS variable)
- # 3. config.tcp.* options contain access credentials to the already
- # installed TCP API endpoint
- pass
-
- return openstack_actions
-
-
-@pytest.mark.revert_snapshot(ext.SNAPSHOT.openstack_deployed)
-@pytest.fixture(scope='function')
-def deploy_openstack(revert_snapshot, request, config,
- hardware, underlay, common_services_deployed,
- openstack_actions):
- """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 OpenstackManager instance
- :rtype: OpenstackManager
-
- 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.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 'openstack_deployed' snapshot, please use mark:
- @pytest.mark.revert_snapshot("openstack_deployed")
- """
- # Create Salt cluster
+ # Deploy Openstack cluster
if not config.openstack.openstack_installed:
steps_path = config.openstack_deploy.openstack_steps_path
commands = underlay.read_template(steps_path)