Move installation steps to YAML filex
- move installation steps to YAML files
- add fixtures and snapshots for install salt, common services
and openstack
- fixtures in conftest.py now are included by python instead of
using pytest plugins
diff --git a/tcp_tests/fixtures/tcp_fixtures.py b/tcp_tests/fixtures/common_services_fixtures.py
similarity index 71%
copy from tcp_tests/fixtures/tcp_fixtures.py
copy to tcp_tests/fixtures/common_services_fixtures.py
index 27b8a1f..4a4ee1d 100644
--- a/tcp_tests/fixtures/tcp_fixtures.py
+++ b/tcp_tests/fixtures/common_services_fixtures.py
@@ -13,18 +13,20 @@
# under the License.
import os
+
import pytest
+import yaml
from tcp_tests import logger
from tcp_tests.helpers import ext
from tcp_tests import settings
-from tcp_tests.managers import tcpmanager
+from tcp_tests.managers import common_services_manager
LOG = logger.logger
@pytest.fixture(scope='function')
-def tcp_actions(config, underlay):
+def common_services_actions(config, underlay):
"""Fixture that provides various actions for K8S
:param config: fixture provides oslo.config
@@ -33,12 +35,13 @@
For use in tests or fixtures to deploy a custom K8S
"""
- return tcpmanager.TCPManager(config, underlay)
+ return common_services_manager.CommonServicesManager(config, underlay)
@pytest.fixture(scope='function')
-def tcpcluster(revert_snapshot, request, config,
- hardware, underlay, tcp_actions):
+def common_services_deployed(revert_snapshot, request, config,
+ hardware, underlay, salt_deployed,
+ common_services_actions):
"""Fixture to get or install TCP on environment
:param request: fixture provides pytest data
@@ -65,15 +68,17 @@
# that belongs to the fixture.
# Note: keep fixtures in strict dependences from each other!
if not revert_snapshot:
- if hardware.has_snapshot(ext.SNAPSHOT.tcp_deployed) and \
- hardware.has_snapshot_config(ext.SNAPSHOT.tcp_deployed):
- hardware.revert_snapshot(ext.SNAPSHOT.tcp_deployed)
+ if hardware.has_snapshot(ext.SNAPSHOT.common_services_deployed) and \
+ hardware.has_snapshot_config(
+ ext.SNAPSHOT.common_services_deployed):
+ hardware.revert_snapshot(ext.SNAPSHOT.common_services_deployed)
- # Create TCP cluster
- if config.tcp.tcp_host == '0.0.0.0':
-
- tcp_actions.install_tcp()
- hardware.create_snapshot(ext.SNAPSHOT.tcp_deployed)
+ # Create Salt cluster
+ if not config.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)
+ hardware.create_snapshot(ext.SNAPSHOT.common_services_deployed)
else:
# 1. hardware environment created and powered on
@@ -83,4 +88,4 @@
# installed TCP API endpoint
pass
- return tcp_actions
+ return common_services_actions
diff --git a/tcp_tests/fixtures/config_fixtures.py b/tcp_tests/fixtures/config_fixtures.py
index ffcaea9..8a2aa27 100644
--- a/tcp_tests/fixtures/config_fixtures.py
+++ b/tcp_tests/fixtures/config_fixtures.py
@@ -20,7 +20,7 @@
@pytest.fixture(scope='session')
def config():
-
+ """Get the global config options from oslo.config INI file"""
config_files = []
tests_configs = os.environ.get('TESTS_CONFIGS', None)
diff --git a/tcp_tests/fixtures/tcp_fixtures.py b/tcp_tests/fixtures/openstack_fixtures.py
similarity index 73%
copy from tcp_tests/fixtures/tcp_fixtures.py
copy to tcp_tests/fixtures/openstack_fixtures.py
index 27b8a1f..48e9125 100644
--- a/tcp_tests/fixtures/tcp_fixtures.py
+++ b/tcp_tests/fixtures/openstack_fixtures.py
@@ -13,18 +13,20 @@
# under the License.
import os
+
import pytest
+import yaml
from tcp_tests import logger
from tcp_tests.helpers import ext
from tcp_tests import settings
-from tcp_tests.managers import tcpmanager
+from tcp_tests.managers import openstack_manager
LOG = logger.logger
@pytest.fixture(scope='function')
-def tcp_actions(config, underlay):
+def openstack_actions(config, underlay):
"""Fixture that provides various actions for K8S
:param config: fixture provides oslo.config
@@ -33,12 +35,13 @@
For use in tests or fixtures to deploy a custom K8S
"""
- return tcpmanager.TCPManager(config, underlay)
+ return openstack_manager.OpenstackManager(config, underlay)
@pytest.fixture(scope='function')
-def tcpcluster(revert_snapshot, request, config,
- hardware, underlay, tcp_actions):
+def openstack_deployed(revert_snapshot, request, config,
+ hardware, underlay, common_services_deployed,
+ openstack_actions):
"""Fixture to get or install TCP on environment
:param request: fixture provides pytest data
@@ -65,15 +68,16 @@
# that belongs to the fixture.
# Note: keep fixtures in strict dependences from each other!
if not revert_snapshot:
- if hardware.has_snapshot(ext.SNAPSHOT.tcp_deployed) and \
- hardware.has_snapshot_config(ext.SNAPSHOT.tcp_deployed):
- hardware.revert_snapshot(ext.SNAPSHOT.tcp_deployed)
+ if hardware.has_snapshot(ext.SNAPSHOT.openstack_deployed) and \
+ hardware.has_snapshot_config(ext.SNAPSHOT.openstack_deployed):
+ hardware.revert_snapshot(ext.SNAPSHOT.openstack_deployed)
- # Create TCP cluster
- if config.tcp.tcp_host == '0.0.0.0':
-
- tcp_actions.install_tcp()
- hardware.create_snapshot(ext.SNAPSHOT.tcp_deployed)
+ # Create Salt cluster
+ if not config.openstack.installed:
+ steps_path = config.openstack_deploy.openstack_steps_path
+ with underlay.yaml_editor(steps_path) as commands:
+ openstack_actions.install(commands.content)
+ hardware.create_snapshot(ext.SNAPSHOT.openstack_deployed)
else:
# 1. hardware environment created and powered on
@@ -83,4 +87,4 @@
# installed TCP API endpoint
pass
- return tcp_actions
+ return openstack_actions
diff --git a/tcp_tests/fixtures/tcp_fixtures.py b/tcp_tests/fixtures/salt_fixtures.py
similarity index 76%
rename from tcp_tests/fixtures/tcp_fixtures.py
rename to tcp_tests/fixtures/salt_fixtures.py
index 27b8a1f..e22b16f 100644
--- a/tcp_tests/fixtures/tcp_fixtures.py
+++ b/tcp_tests/fixtures/salt_fixtures.py
@@ -13,18 +13,20 @@
# under the License.
import os
+
import pytest
+import yaml
from tcp_tests import logger
from tcp_tests.helpers import ext
from tcp_tests import settings
-from tcp_tests.managers import tcpmanager
+from tcp_tests.managers import saltmanager
LOG = logger.logger
@pytest.fixture(scope='function')
-def tcp_actions(config, underlay):
+def salt_actions(config, underlay):
"""Fixture that provides various actions for K8S
:param config: fixture provides oslo.config
@@ -33,12 +35,12 @@
For use in tests or fixtures to deploy a custom K8S
"""
- return tcpmanager.TCPManager(config, underlay)
+ return saltmanager.SaltManager(config, underlay)
@pytest.fixture(scope='function')
-def tcpcluster(revert_snapshot, request, config,
- hardware, underlay, tcp_actions):
+def salt_deployed(revert_snapshot, request, config,
+ hardware, underlay, salt_actions):
"""Fixture to get or install TCP on environment
:param request: fixture provides pytest data
@@ -65,15 +67,16 @@
# that belongs to the fixture.
# Note: keep fixtures in strict dependences from each other!
if not revert_snapshot:
- if hardware.has_snapshot(ext.SNAPSHOT.tcp_deployed) and \
- hardware.has_snapshot_config(ext.SNAPSHOT.tcp_deployed):
- hardware.revert_snapshot(ext.SNAPSHOT.tcp_deployed)
+ if hardware.has_snapshot(ext.SNAPSHOT.salt_deployed) and \
+ hardware.has_snapshot_config(ext.SNAPSHOT.salt_deployed):
+ hardware.revert_snapshot(ext.SNAPSHOT.salt_deployed)
- # Create TCP cluster
- if config.tcp.tcp_host == '0.0.0.0':
-
- tcp_actions.install_tcp()
- hardware.create_snapshot(ext.SNAPSHOT.tcp_deployed)
+ # Create Salt cluster
+ if config.salt.salt_master_host == '0.0.0.0':
+ with underlay.yaml_editor(
+ config.salt_deploy.salt_steps_path) as commands:
+ salt_actions.install(commands.content)
+ hardware.create_snapshot(ext.SNAPSHOT.salt_deployed)
else:
# 1. hardware environment created and powered on
@@ -83,4 +86,4 @@
# installed TCP API endpoint
pass
- return tcp_actions
+ return salt_actions