Add markers to system tests
fuel_ccp_tests can be installed as a package: pip install git+git://github.com/openstack/fuel-ccp-tests --upgrade To run the test, use 'fuel_ccp_tests' CLI and pytest marks: fuel_ccp_tests -k fuel_ccp_installer # Run all the k8s install tests fuel_ccp_tests -k ccp_cli_errexit_codes # Run all errorcode tests fuel_ccp_tests -k deploy_openstack # Run ccp install test fuel_ccp_tests -k horizon_component # Run pre-commit test # for horizon Change-Id: Ib5b1869264529661958840fced5b7c49e6f19647
This commit is contained in:
parent
8d322cd78d
commit
be41fbba5d
24
fuel_ccp_tests/run_test.py
Normal file
24
fuel_ccp_tests/run_test.py
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
import fuel_ccp_tests
|
||||
|
||||
|
||||
def shell():
|
||||
if len(sys.argv) > 1:
|
||||
# Run py.test for fuel_ccp_tests module folder with specified options
|
||||
testpaths = os.path.dirname(fuel_ccp_tests.__file__)
|
||||
opts = ' '.join(sys.argv[1:])
|
||||
addopts = '-vvv -s -p no:django -p no:ipdb --junit-xml=nosetests.xml'
|
||||
return pytest.main('{testpaths} {addopts} {opts}'.format(
|
||||
testpaths=testpaths, addopts=addopts, opts=opts))
|
||||
else:
|
||||
return pytest.main('--help')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(shell())
|
@ -38,6 +38,9 @@ class TestServiceHorizon(object):
|
||||
def test_horizon_component(self, config, underlay,
|
||||
k8scluster, ccpcluster):
|
||||
"""Horizon pre-commit test
|
||||
|
||||
pytest.mark: horizon_component
|
||||
|
||||
Scenario:
|
||||
1. Fetch all repos
|
||||
2. Update horizon source form local path
|
||||
|
@ -19,6 +19,7 @@ from fuel_ccp_tests.logger import logger
|
||||
|
||||
@pytest.yield_fixture(scope='module')
|
||||
def admin_node(config, underlay, ccpcluster):
|
||||
"""Return <remote> object to k8s admin node"""
|
||||
logger.info("Get SSH access to admin node")
|
||||
with underlay.remote(host=config.k8s.kube_host) as remote:
|
||||
yield remote
|
||||
@ -29,8 +30,14 @@ def clean_repos(node):
|
||||
node.execute(cmd, verbose=True)
|
||||
|
||||
|
||||
@pytest.mark.ccp_cli_errexit_codes
|
||||
@pytest.mark.ccp_cli_error_in_fetch
|
||||
class TestCppCliErrorInFetch(object):
|
||||
"""Check exit codes when fetch is failing"""
|
||||
"""Check exit codes when fetch is failing
|
||||
|
||||
pytest.mark: ccp_cli_error_in_fetch
|
||||
module pytest.mark: ccp_cli_errexit_codes
|
||||
"""
|
||||
|
||||
@pytest.mark.fail_snapshot
|
||||
def test_wrong_repo_name(self, admin_node):
|
||||
@ -52,8 +59,14 @@ class TestCppCliErrorInFetch(object):
|
||||
clean_repos(admin_node)
|
||||
|
||||
|
||||
class TestCppCliBuild(object):
|
||||
"""Check exit codes when build is failing"""
|
||||
@pytest.mark.ccp_cli_errexit_codes
|
||||
@pytest.mark.ccp_cli_build_exit_code
|
||||
class TestCppCliBuildExitCode(object):
|
||||
"""Check exit codes when build is failing
|
||||
|
||||
pytest.mark: ccp_cli_build_exit_code
|
||||
module pytest.mark: ccp_cli_errexit_codes
|
||||
"""
|
||||
|
||||
@pytest.mark.fail_snapshot
|
||||
def test_nonexistent_repo_name(self, admin_node):
|
||||
@ -73,8 +86,14 @@ class TestCppCliBuild(object):
|
||||
clean_repos(admin_node)
|
||||
|
||||
|
||||
@pytest.mark.ccp_cli_errexit_codes
|
||||
@pytest.mark.ccp_cli_deploy_exit_code
|
||||
class TestCppCliDeploy(object):
|
||||
"""Check exit codes when deploy is failing"""
|
||||
"""Check exit codes when deploy is failing
|
||||
|
||||
pytest.mark: ccp_cli_deploy_exit_code
|
||||
module pytest.mark: ccp_cli_errexit_codes
|
||||
"""
|
||||
|
||||
@pytest.mark.fail_snapshot
|
||||
def test_nonexistent_repo_name(self, admin_node):
|
||||
|
@ -33,9 +33,13 @@ class FuelCCPInstallerConfigMixin:
|
||||
custom_yaml_images = base_images + [kube_settings['hyperkube_image_repo']]
|
||||
|
||||
|
||||
@pytest.mark.fuel_ccp_installer
|
||||
class TestFuelCCPInstaller(base_test.SystemBaseTest,
|
||||
FuelCCPInstallerConfigMixin):
|
||||
"""Test class for testing k8s deployed by fuel-ccp-installer"""
|
||||
"""Test class for testing k8s deployed by fuel-ccp-installer
|
||||
|
||||
pytest.mark: fuel_ccp_installer
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_nginx_spec(k8s_node=None):
|
||||
@ -71,12 +75,15 @@ class TestFuelCCPInstaller(base_test.SystemBaseTest,
|
||||
cmd = "curl http://{}".format(ip)
|
||||
underlay.sudo_check_call(cmd=cmd, node_name=env_node, verbose=True)
|
||||
|
||||
@pytest.mark.k8s_installed_default
|
||||
@pytest.mark.snapshot_needed
|
||||
@pytest.mark.revert_snapshot(ext.SNAPSHOT.initial)
|
||||
@pytest.mark.fail_snapshot
|
||||
def test_k8s_installed_default(self, underlay, k8s_actions):
|
||||
"""Test for deploying an k8s environment and check it
|
||||
|
||||
pytest.mark: k8s_installed_default
|
||||
|
||||
Scenario:
|
||||
1. Install k8s.
|
||||
2. Check number of nodes.
|
||||
@ -99,12 +106,15 @@ class TestFuelCCPInstaller(base_test.SystemBaseTest,
|
||||
self.check_nginx_pod_is_reached(underlay, pod.status.pod_ip)
|
||||
self.check_pod_delete(pod, k8sclient)
|
||||
|
||||
@pytest.mark.k8s_installed_with_etcd_on_host
|
||||
@pytest.mark.snapshot_needed
|
||||
@pytest.mark.revert_snapshot(ext.SNAPSHOT.initial)
|
||||
@pytest.mark.fail_snapshot
|
||||
def test_k8s_installed_with_etcd_on_host(self, underlay, k8s_actions):
|
||||
"""Test for deploying an k8s environment and check it
|
||||
|
||||
pytest.mark: k8s_installed_with_etcd_on_host
|
||||
|
||||
Scenario:
|
||||
1. Install k8s with forced etcd on host.
|
||||
2. Check number of nodes.
|
||||
@ -138,12 +148,15 @@ class TestFuelCCPInstaller(base_test.SystemBaseTest,
|
||||
self.check_nginx_pod_is_reached(underlay, pod.status.pod_ip)
|
||||
self.check_pod_delete(pod, k8sclient)
|
||||
|
||||
@pytest.mark.k8s_installed_with_etcd_in_container
|
||||
@pytest.mark.snapshot_needed
|
||||
@pytest.mark.revert_snapshot(ext.SNAPSHOT.initial)
|
||||
@pytest.mark.fail_snapshot
|
||||
def test_k8s_installed_with_etcd_in_container(self, underlay, k8s_actions):
|
||||
"""Test for deploying an k8s environment and check it
|
||||
|
||||
pytest.mark: k8s_installed_with_etcd_in_container
|
||||
|
||||
Scenario:
|
||||
1. Install k8s with forced etcd in container.
|
||||
2. Check number of nodes.
|
||||
@ -177,6 +190,7 @@ class TestFuelCCPInstaller(base_test.SystemBaseTest,
|
||||
self.check_nginx_pod_is_reached(underlay, pod.status.pod_ip)
|
||||
self.check_pod_delete(pod, k8sclient)
|
||||
|
||||
@pytest.mark.k8s_installed_with_ready_ssh_keys
|
||||
@pytest.mark.snapshot_needed
|
||||
@pytest.mark.revert_snapshot(ext.SNAPSHOT.initial)
|
||||
@pytest.mark.fail_snapshot
|
||||
@ -184,6 +198,8 @@ class TestFuelCCPInstaller(base_test.SystemBaseTest,
|
||||
underlay, k8s_actions):
|
||||
"""Test for deploying an k8s environment and check it
|
||||
|
||||
pytest.mark: k8s_installed_with_ready_ssh_keys
|
||||
|
||||
Scenario:
|
||||
1. Install k8s (with prepared ssh keys).
|
||||
2. Check number of nodes.
|
||||
|
@ -25,8 +25,12 @@ from fuel_ccp_tests.helpers import ext
|
||||
LOG = logger.logger
|
||||
|
||||
|
||||
@pytest.mark.deploy_openstack
|
||||
class TestDeployOpenstack(base_test.SystemBaseTest):
|
||||
"""Create VMs for mcpinstaller"""
|
||||
"""Deploy OpenStack with CCP
|
||||
|
||||
pytest.mark: deploy_openstack
|
||||
"""
|
||||
snapshot_microservices_deployed = 'snapshot_microservices_deployed'
|
||||
|
||||
def get_params(self, params_list, exclude_list=None):
|
||||
|
Loading…
Reference in New Issue
Block a user