Automate few OS clusters tests

- Add deployment test with 2 OS where controllers on the same node
- Add test with deployment of 3 OS with controllers
only on the same node
- Add test with deleting keystone service from 1 deployment
and check second cluster works
- Add test with deleting nova-api service from 1 deployment
and check second cluster works

Change-Id: Iaa7dbc2fc7f1433faa3b51cc752bf57742114f19
This commit is contained in:
asledzinskiy 2016-10-04 13:28:47 +03:00
parent 641bedc07d
commit 84e22e7cff
6 changed files with 305 additions and 25 deletions

View File

@ -51,10 +51,10 @@ class K8sServiceManager(K8sBaseManager):
return self.api.replace_namespaced_service(
body=body, name=name, namespace=namespace, **kwargs)
def _delete(self, body, name, namespace=None, **kwargs):
def _delete(self, name, namespace=None, **kwargs):
namespace = namespace or self.namespace
return self.api.delete_namespaced_service(
body=body, name=name, namespace=namespace, **kwargs)
name=name, namespace=namespace, **kwargs)
def full_list(self, *args, **kwargs):
lst = self._full_list(*args, **kwargs)

View File

@ -0,0 +1,32 @@
nodes:
node1:
roles:
- openvswitch
- controller-net-host
- controller-net-bridge
roles:
controller-net-host:
- neutron-dhcp-agent
- neutron-l3-agent
- neutron-metadata-agent
controller-net-bridge:
- etcd
- glance-api
- glance-registry
- heat-api
- heat-engine
- horizon
- keystone
- mariadb
- memcached
- neutron-server
- nova-api
- nova-conductor
- nova-consoleauth
- nova-novncproxy
- nova-scheduler
- rabbitmq
openvswitch:
- neutron-openvswitch-agent
- openvswitch-db
- openvswitch-vswitchd

View File

@ -37,8 +37,4 @@ roles:
openvswitch:
- neutron-openvswitch-agent
- openvswitch-db
- openvswitch-vswitchd
configs:
public_interface: ens3
private_interface: ens4
neutron_external_interface: ens5
- openvswitch-vswitchd

View File

@ -37,8 +37,4 @@ roles:
openvswitch:
- neutron-openvswitch-agent
- openvswitch-db
- openvswitch-vswitchd
configs:
public_interface: ens3
private_interface: ens4
neutron_external_interface: ens5
- openvswitch-vswitchd

View File

@ -0,0 +1,40 @@
nodes:
node1:
roles:
- openvswitch
- controller-net-host
- controller-net-bridge
node[4-5]:
roles:
- openvswitch
- compute
- controller-net-bridge
roles:
controller-net-host:
- neutron-dhcp-agent
- neutron-l3-agent
- neutron-metadata-agent
controller-net-bridge:
- etcd
- glance-api
- glance-registry
- heat-api
- heat-engine
- horizon
- keystone
- mariadb
- memcached
- neutron-server
- nova-api
- nova-conductor
- nova-consoleauth
- nova-novncproxy
- nova-scheduler
- rabbitmq
compute:
- nova-compute
- nova-libvirt
openvswitch:
- neutron-openvswitch-agent
- openvswitch-db
- openvswitch-vswitchd

View File

@ -11,6 +11,7 @@
# 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 copy
import os
import pytest
@ -19,7 +20,6 @@ from fuel_ccp_tests import logger
from fuel_ccp_tests import settings
from fuel_ccp_tests.helpers import ext
from fuel_ccp_tests.helpers import post_os_deploy_checks
from fuel_ccp_tests.helpers import utils
LOG = logger.logger
@ -41,7 +41,7 @@ class TestDeployTwoOS(base_test.SystemBaseTest):
3. Deploy one OS cluster
4. Check deployment
5. Create 2 vms
6. Deploy another OS cluster
6. Deploy another OS cluster on different nodes
7. Check deployment
8. Create 2 vms
@ -55,32 +55,248 @@ class TestDeployTwoOS(base_test.SystemBaseTest):
'1ctrl_1comp.yaml'
remote = underlay.remote(host=config.k8s.kube_host)
remote.upload(topology_path, '/tmp')
utils.update_yaml(["deploy_config"], "/tmp/1ctrl_1comp.yaml",
yaml_file="./.ccp.yaml", remote=remote)
ccpcluster.put_yaml_config('./config_1.yaml', settings.CCP_CONF)
ccpcluster.add_includes('./config_1.yaml', [
settings.CCP_DEPLOY_CONFIG,
settings.CCP_SOURCES_CONFIG,
'/tmp/1ctrl_1comp.yaml'])
underlay.sudo_check_call("pip install python-openstackclient",
host=config.k8s.kube_host)
ccpcluster.deploy()
ccpcluster.deploy(params={"config-file": "./config_1.yaml"})
post_os_deploy_checks.check_jobs_status(k8s_actions.api, timeout=2000)
post_os_deploy_checks.check_pods_status(k8s_actions.api)
remote.check_call(
"source openrc-{}; bash fuel-ccp/tools/deploy-test-vms.sh -a"
" create".format(settings.CCP_CONF["kubernetes"]["namespace"]),
" create -i {1}".format(
settings.CCP_CONF["kubernetes"]["namespace"],
settings.IFACES['public']),
timeout=600)
topology_path = \
os.getcwd() + '/fuel_ccp_tests/templates/k8s_templates/' \
'1ctrl_1comp_2.yaml'
'1ctrl_1comp_diff.yaml'
remote.upload(topology_path, '/tmp')
utils.update_yaml(["deploy_config"], "/tmp/1ctrl_1comp_2.yaml",
yaml_file="./.ccp.yaml", remote=remote)
utils.update_yaml(["kubernetes", "namespace"], "ccp-second",
yaml_file="./.ccp.yaml", remote=remote)
ccpcluster.deploy()
conf = copy.deepcopy(settings.CCP_CONF)
conf['kubernetes']['namespace'] = 'ccp-second'
ccpcluster.put_yaml_config('./config_2.yaml', conf)
ccpcluster.add_includes('./config_2.yaml', [
settings.CCP_DEPLOY_CONFIG,
settings.CCP_SOURCES_CONFIG,
'/tmp/1ctrl_1comp_diff.yaml'])
ccpcluster.deploy(params={"config-file": "./config_2.yaml"})
post_os_deploy_checks.check_jobs_status(k8s_actions.api, timeout=2000,
namespace="ccp-second")
post_os_deploy_checks.check_pods_status(k8s_actions.api,
namespace="ccp-second")
remote.check_call(
"source openrc-{}; bash fuel-ccp/tools/deploy-test-vms.sh -a"
" create -i {1}".format(
settings.CCP_CONF["kubernetes"]["namespace"],
settings.IFACES['public']),
timeout=600)
@pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed)
@pytest.mark.snapshot_needed(name="two_os")
@pytest.mark.deploy_two_os
@pytest.mark.fail_snapshot
@pytest.mark.system_few_os
def test_deploy_two_os_same_ctrl(self, underlay, config,
ccpcluster, k8s_actions):
"""Deploy base environment
Scenario:
1. Revert snapshot
2. Install microservices
3. Deploy one OS cluster
4. Check deployment
5. Create 2 vms
6. Deploy another OS cluster, controller on the same node
7. Check deployment
8. Create 2 vms
Duration 90 min
"""
if not settings.REGISTRY:
k8s_actions.create_registry()
ccpcluster.build()
topology_path = \
os.getcwd() + '/fuel_ccp_tests/templates/k8s_templates/' \
'1ctrl_1comp.yaml'
remote = underlay.remote(host=config.k8s.kube_host)
remote.upload(topology_path, '/tmp')
ccpcluster.put_yaml_config('./config_1.yaml', settings.CCP_CONF)
ccpcluster.add_includes('./config_1.yaml', [
settings.CCP_DEPLOY_CONFIG,
settings.CCP_SOURCES_CONFIG,
'/tmp/1ctrl_1comp.yaml'])
underlay.sudo_check_call("pip install python-openstackclient",
host=config.k8s.kube_host)
ccpcluster.deploy(params={"config-file": "./config_1.yaml"})
post_os_deploy_checks.check_jobs_status(k8s_actions.api, timeout=2000)
post_os_deploy_checks.check_pods_status(k8s_actions.api)
remote.check_call(
"source openrc-{}; bash fuel-ccp/tools/deploy-test-vms.sh -a"
" create -i {1}".format(
settings.CCP_CONF["kubernetes"]["namespace"],
settings.IFACES['public']),
timeout=600)
topology_path = \
os.getcwd() + '/fuel_ccp_tests/templates/k8s_templates/' \
'1ctrl_1comp_same.yaml'
remote.upload(topology_path, '/tmp')
conf = copy.deepcopy(settings.CCP_CONF)
conf['kubernetes']['namespace'] = 'ccp-second'
ccpcluster.put_yaml_config('./config_2.yaml', conf)
ccpcluster.add_includes('./config_2.yaml', [
settings.CCP_DEPLOY_CONFIG,
settings.CCP_SOURCES_CONFIG,
'/tmp/1ctrl_1comp_same.yaml'])
ccpcluster.deploy(params={"config-file": "./config_2.yaml"})
post_os_deploy_checks.check_jobs_status(k8s_actions.api, timeout=2000,
namespace="ccp-second")
post_os_deploy_checks.check_pods_status(k8s_actions.api,
namespace="ccp-second")
remote.check_call(
"source openrc-{}; bash fuel-ccp/tools/deploy-test-vms.sh -a"
" create -i {1}".format(
settings.CCP_CONF["kubernetes"]["namespace"],
settings.IFACES['public']),
timeout=600)
@pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed)
@pytest.mark.deploy_two_os
@pytest.mark.fail_snapshot
@pytest.mark.system_few_os
def test_deploy_3_ctrl(self, underlay, config, ccpcluster, k8s_actions):
"""Deploy base environment
Scenario:
1. Revert snapshot
2. Install microservices
3. Deploy one OS cluster with 1 controller
4. Check deployment
5. Create flavor
6. Deploy another OS cluster with 1 controller
7. Check deployment
8. Create flavor
9. Deploy another OS cluster with 1 controller
10. Check deployment
11. Create flavor
Duration 60 min
"""
if not settings.REGISTRY:
k8s_actions.create_registry()
ccpcluster.build()
topology_path = \
os.getcwd() + '/fuel_ccp_tests/templates/k8s_templates/' \
'1ctrl.yaml'
remote = underlay.remote(host=config.k8s.kube_host)
remote.upload(topology_path, '/tmp')
ccpcluster.put_yaml_config('./config_1.yaml', settings.CCP_CONF)
ccpcluster.add_includes('./config_1.yaml', [
settings.CCP_DEPLOY_CONFIG,
settings.CCP_SOURCES_CONFIG,
'/tmp/1ctrl.yaml'])
underlay.sudo_check_call("pip install python-openstackclient",
host=config.k8s.kube_host)
ccpcluster.deploy(params={"config-file": "./config_1.yaml"})
post_os_deploy_checks.check_jobs_status(k8s_actions.api, timeout=2000)
post_os_deploy_checks.check_pods_status(k8s_actions.api)
remote.check_call(
"source openrc-{}; openstack flavor create"
" test".format(settings.CCP_CONF["kubernetes"]["namespace"]),
timeout=600)
remote.check_call("sed -i '/node[1-9]/c\ node2:' /tmp/1ctrl.yaml")
conf = copy.deepcopy(settings.CCP_CONF)
conf['kubernetes']['namespace'] = 'ccp-second'
ccpcluster.put_yaml_config('./config_2.yaml', conf)
ccpcluster.add_includes('./config_2.yaml', [
settings.CCP_DEPLOY_CONFIG,
settings.CCP_SOURCES_CONFIG,
'/tmp/1ctrl.yaml'])
ccpcluster.deploy(params={"config-file": "./config_2.yaml"})
post_os_deploy_checks.check_jobs_status(k8s_actions.api, timeout=2000,
namespace="ccp-second")
post_os_deploy_checks.check_pods_status(k8s_actions.api,
namespace="ccp-second")
remote.check_call(
"source openrc-ccp-second;"
" bash fuel-ccp/tools/deploy-test-vms.sh -a create",
" openstack flavor create test",
timeout=600)
remote.check_call("sed -i '/node[1-9]/c\ node3:' /tmp/1ctrl.yaml")
conf = copy.deepcopy(settings.CCP_CONF)
conf['kubernetes']['namespace'] = 'ccp-third'
ccpcluster.put_yaml_config('./config_3.yaml', conf)
ccpcluster.add_includes('./config_3.yaml', [
settings.CCP_DEPLOY_CONFIG,
settings.CCP_SOURCES_CONFIG,
'/tmp/1ctrl.yaml'])
ccpcluster.deploy(params={"config-file": "./config_3.yaml"})
post_os_deploy_checks.check_jobs_status(k8s_actions.api, timeout=2000,
namespace="ccp-third")
post_os_deploy_checks.check_pods_status(k8s_actions.api,
namespace="ccp-third")
remote.check_call(
"source openrc-ccp-third;"
" openstack flavor create test",
timeout=600)
@pytest.mark.revert_snapshot(name="two_os")
@pytest.mark.deploy_two_os
@pytest.mark.fail_snapshot
@pytest.mark.system_few_os
def test_deploy_two_os_kill_keystone(self, underlay, config, k8s_actions):
"""Deploy base environment
Scenario:
1. Revert snapshot with 2 deployed OS
2. Delete keystone service from first deployment
3. Check second cluster is operational
Duration 15 min
"""
remote = underlay.remote(host=config.k8s.kube_host)
k8s_actions.api.services.delete(
name='keystone',
namespace=settings.CCP_CONF["kubernetes"]["namespace"])
remote.check_call(
"source openrc-{}; bash fuel-ccp/tools/deploy-test-vms.sh -a"
" create -i {1}".format(
settings.CCP_CONF["kubernetes"]["namespace"],
settings.IFACES['public']),
timeout=600)
@pytest.mark.revert_snapshot(name="two_os")
@pytest.mark.deploy_two_os
@pytest.mark.fail_snapshot
@pytest.mark.system_few_os
def test_deploy_two_os_kill_nova(self, underlay, config, k8s_actions):
"""Deploy base environment
Scenario:
1. Revert snapshot with 2 deployed OS
2. Delete nova-api service from first deployment
3. Check second cluster is operational
Duration 90 min
"""
remote = underlay.remote(host=config.k8s.kube_host)
k8s_actions.api.services.delete(
name='nova-api',
namespace=settings.CCP_CONF["kubernetes"]["namespace"])
remote.check_call(
"source openrc-{}; bash fuel-ccp/tools/deploy-test-vms.sh -a"
" create -i {1}".format(
settings.CCP_CONF["kubernetes"]["namespace"],
settings.IFACES['public']),
timeout=600)