Add test with 2 OS clusters

- Add test where we deploy 2 OS clusters and
check that vms can be created

Change-Id: I699adac11a3d3507236626aa95da15f3002d0720
This commit is contained in:
asledzinskiy 2016-09-19 13:42:13 +03:00
parent e5bdc8d9e6
commit 6f07259b04
6 changed files with 306 additions and 8 deletions

View File

@ -33,19 +33,23 @@ def get_test_method_name():
def update_yaml(yaml_tree=None, yaml_value='', is_uniq=True,
yaml_file=settings.TIMESTAT_PATH_YAML):
yaml_file=settings.TIMESTAT_PATH_YAML, remote=None):
"""Store/update a variable in YAML file.
yaml_tree - path to the variable in YAML file, will be created if absent,
yaml_value - value of the variable, will be overwritten if exists,
is_uniq - If false, add the unique two-digit suffix to the variable name.
"""
def get_file(path, remote=None, mode="r"):
if remote:
return remote.open(path, mode)
else:
return open(path, mode)
if yaml_tree is None:
yaml_tree = []
yaml_data = {}
if os.path.isfile(yaml_file):
with open(yaml_file, 'r') as f:
yaml_data = yaml.load(f)
with get_file(yaml_file, remote) as file_obj:
yaml_data = yaml.safe_load(file_obj)
# Walk through the 'yaml_data' dict, find or create a tree using
# sub-keys in order provided in 'yaml_tree' list
@ -65,8 +69,8 @@ def update_yaml(yaml_tree=None, yaml_value='', is_uniq=True,
break
item[last] = yaml_value
with open(yaml_file, 'w') as f:
yaml.dump(yaml_data, f, default_flow_style=False)
with get_file(yaml_file, remote, mode='w') as file_obj:
yaml.dump(yaml_data, file_obj, default_flow_style=False)
class TimeStat(object):

View File

@ -91,7 +91,7 @@ rally verify showconfig"""
self.docker_id = res['stdout'][0].strip()
LOG.info("Container ID is {}".format(self.docker_id))
def run_tempest(self, test):
def run_tempest(self, test=''):
docker_exec = ('source /home/{user}/rally/openrc; '
'docker exec -i {docker_id} bash -c "{cmd}"')
commands = [

View File

@ -0,0 +1,120 @@
---
aliases:
dynamic_addresses_pool:
- &pool_default !os_env POOL_DEFAULT, 10.100.0.0/16:24
default_interface_model:
- &interface_model !os_env INTERFACE_MODEL, e1000
template:
devops_settings:
env_name: !os_env ENV_NAME
address_pools:
public-pool01:
net: *pool_default
params:
vlan_start: 1210
ip_reserved:
gateway: +1
l2_network_device: +1
ip_ranges:
dhcp: [+128, -32]
rack-01: [+2, +127]
private-pool01:
net: *pool_default
params:
ip_reserved:
l2_network_device: +1
ip_ranges:
dhcp: [+128, -32]
neutron-pool01:
net: *pool_default
groups:
- name: default
driver:
name: devops.driver.libvirt
params:
connection_string: !os_env CONNECTION_STRING, qemu:///system
storage_pool_name: !os_env STORAGE_POOL_NAME, default
stp: False
hpet: False
use_host_cpu: !os_env DRIVER_USE_HOST_CPU, true
network_pools:
public: public-pool01
private: private-pool01
neutron: neutron-pool01
l2_network_devices:
public:
address_pool: public-pool01
dhcp: true
forward:
mode: nat
private:
address_pool: private-pool01
dhcp: true
neutron:
address_pool: neutron-pool01
dhcp: false
group_volumes:
- name: baseimage # This name is used for 'backing_store' option for node volumes.
source_image: !os_env IMAGE_PATH
format: qcow2
nodes:
- name: master
role: k8s
params: &rack-01-node-params
vcpu: !os_env SLAVE_NODE_CPU, 2
memory: !os_env SLAVE_NODE_MEMORY, 8192
boot:
- network
- hd
volumes:
- name: system
capacity: !os_env NODE_VOLUME_SIZE, 150
backing_store: baseimage
format: qcow2
interfaces:
- label: iface0
l2_network_device: public
interface_model: *interface_model
- label: iface1
l2_network_device: private
interface_model: *interface_model
- label: iface2
l2_network_device: neutron
interface_model: *interface_model
network_config:
iface0:
networks:
- public
iface1:
networks:
- private
iface2:
networks:
- neutron
- name: slave-0
role: k8s
params: *rack-01-node-params
- name: slave-1
role: k8s
params: *rack-01-node-params
- name: slave-2
role: k8s
params: *rack-01-node-params
- name: slave-3
role: k8s
params: *rack-01-node-params

View File

@ -0,0 +1,44 @@
nodes:
node1:
roles:
- openvswitch
- controller-net-host
- controller-net-bridge
node[2-3]:
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
configs:
private_interface: eth0
public_interface: eth1
neutron_external_interface: eth2

View File

@ -0,0 +1,44 @@
nodes:
node4:
roles:
- openvswitch
- controller-net-host
- controller-net-bridge
node5:
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
configs:
private_interface: eth0
public_interface: eth1
neutron_external_interface: eth2

View File

@ -0,0 +1,86 @@
# 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 os
import pytest
import base_test
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
class TestDeployTwoOS(base_test.SystemBaseTest):
"""Deploy Two OpenStack clusters with CCP
"""
@pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed)
@pytest.mark.deploy_two_os
@pytest.mark.fail_snapshot
@pytest.mark.system
def test_deploy_two_os(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
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')
utils.update_yaml(["deploy_config"], "/tmp/1ctrl_1comp.yaml",
yaml_file="./.ccp.yaml", remote=remote)
underlay.sudo_check_call("pip install python-openstackclient",
host=config.k8s.kube_host)
ccpcluster.deploy()
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"]),
timeout=600)
topology_path = \
os.getcwd() + '/fuel_ccp_tests/templates/k8s_templates/' \
'1ctrl_1comp_2.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()
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",
timeout=600)