Extend tests for UCA deployment

Add checks for some packages for ensuring that
UCA repositories were used during deployment process

Add new deployment scenarios for NeutronTun + Ceph cluster and cluster
with ceilometer

Implements: blueprint deploy-with-uca-packages
Change-Id: I4623ee60c992905f07288f15793fcbd7a0019f98
This commit is contained in:
Vladimir Khlyunev 2016-04-21 16:27:23 +03:00
parent cde599a349
commit fd7f38f269

View File

@ -13,16 +13,66 @@
# under the License. # under the License.
from proboscis import test from proboscis import test
from proboscis.asserts import assert_true, assert_is_not_none
from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test import logger
from fuelweb_test import settings from fuelweb_test import settings
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.helpers.ssh_manager import SSHManager
from fuelweb_test.tests.base_test_case import SetupEnvironment from fuelweb_test.tests.base_test_case import SetupEnvironment
from fuelweb_test.tests.base_test_case import TestBasic from fuelweb_test.tests.base_test_case import TestBasic
@test(groups=["uca_neutron_ha"]) @test(groups=["deploy_from_uca"])
class UCATest(TestBasic): class UCATest(TestBasic):
"""UCATest.""" # TODO(mattymo) documentation """Tests for "enable deployment from ubuntu cloud archive" feature.
Deploy several cluster using Ubuntu+UCA release then validate packages
origin (ubuntu-cloud.archive.canonical.com)"""
def get_uca_repo(self, cluster_id):
"""Pick link to UCA repository from cluster settings"""
repos = self.fuel_web.get_cluster_repos(cluster_id)
template = '{uri}/ {suite}/{section}'
uca_repo = None
for repo in repos['value']:
if repo['name'] == 'uca':
uca_repo = template.format(**repo)
break
assert_is_not_none(uca_repo, "UCA repo was not found!")
assert_true("ubuntu-cloud.archive.canonical.com" in uca_repo,
"{!r} does not contains link to UCA repo".format(uca_repo))
return uca_repo
@staticmethod
def check_package_origin(ip, package, origin):
"""Check that given package was installed from given repository"""
version_cmd = ("apt-cache policy {package} | "
"awk '$1 == \"Installed:\" {{print $2}}'").format(
package=package)
version = SSHManager().execute_on_remote(ip, version_cmd)['stdout_str']
origin_cmd = ("apt-cache madison {package} | "
"grep {version}").format(package=package,
version=version)
result = SSHManager().execute_on_remote(ip, origin_cmd)['stdout']
repos = [str.strip(line.split("|")[2]) for line in result]
assert_true(
any([origin in repo for repo in repos]),
"Package {!r}: repository {!r} not found in {!r}".format(
package, origin, repos)
)
@staticmethod
def get_os_packages(ip, packages_pattern=None):
"""Pick names of some OS packages from node"""
if not packages_pattern:
packages_pattern = "neutron|nova|cinder|keystone|" \
"ceilometer|ironic|glance"
packages = SSHManager().execute_on_remote(
ip, "dpkg-query -W -f '${{package}}\n' | grep -E '{}'".format(
packages_pattern)
)['stdout_str']
return packages.split('\n')
@test(depends_on=[SetupEnvironment.prepare_slaves_5], @test(depends_on=[SetupEnvironment.prepare_slaves_5],
groups=["uca_neutron_ha"]) groups=["uca_neutron_ha"])
@ -31,13 +81,14 @@ class UCATest(TestBasic):
"""Deploy cluster in ha mode with UCA repo """Deploy cluster in ha mode with UCA repo
Scenario: Scenario:
1. Create cluster 1. Create cluster using UCA release
2. Enable UCA configuration 2. Add 3 nodes with controller role
3. Add 3 nodes with controller role 3. Add 2 nodes with compute+cinder role
4. Add 2 nodes with compute+cinder role 4. Run network verification
5. Deploy the cluster 5. Deploy the cluster
6. Run network verification 6. Run network verification
7. Run OSTF 7. Ensure that openstack packages were taken from UCA repository
8. Run OSTF
Duration 60m Duration 60m
Snapshot uca_neutron_ha Snapshot uca_neutron_ha
@ -46,8 +97,7 @@ class UCATest(TestBasic):
uca_enabled = {'uca_enabled': True} uca_enabled = {'uca_enabled': True}
self.show_step(1, initialize=True) self.show_step(1)
self.show_step(2)
cluster_id = self.fuel_web.create_cluster( cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__, name=self.__class__.__name__,
mode=settings.DEPLOYMENT_MODE, mode=settings.DEPLOYMENT_MODE,
@ -55,8 +105,8 @@ class UCATest(TestBasic):
settings=uca_enabled settings=uca_enabled
) )
self.show_step(2)
self.show_step(3) self.show_step(3)
self.show_step(4)
self.fuel_web.update_nodes( self.fuel_web.update_nodes(
cluster_id, cluster_id,
{ {
@ -67,6 +117,10 @@ class UCATest(TestBasic):
'slave-05': ['compute', 'cinder'], 'slave-05': ['compute', 'cinder'],
} }
) )
self.show_step(4)
self.fuel_web.verify_network(cluster_id)
self.show_step(5) self.show_step(5)
self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.deploy_cluster_wait(cluster_id)
@ -74,6 +128,169 @@ class UCATest(TestBasic):
self.fuel_web.verify_network(cluster_id) self.fuel_web.verify_network(cluster_id)
self.show_step(7) self.show_step(7)
uca_repo = self.get_uca_repo(cluster_id)
assert_is_not_none(uca_repo, "UCA repo was not found!")
for node in self.fuel_web.client.list_cluster_nodes(cluster_id):
logger.info("Checking packages on node {!r}".format(node['name']))
packages = self.get_os_packages(node['ip'])
for package in packages:
self.check_package_origin(node['ip'], package, uca_repo)
self.show_step(8)
self.fuel_web.run_ostf(cluster_id=cluster_id) self.fuel_web.run_ostf(cluster_id=cluster_id)
self.env.make_snapshot("uca_neutron_ha") self.env.make_snapshot("uca_neutron_ha")
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
groups=["uca_neutron_tun_ceph"])
@log_snapshot_after_test
def uca_neutron_tun_ceph(self):
"""Deploy cluster with NeutronTUN, Ceph and UCA repo
Scenario:
1. Create cluster using UCA release
2. Add 3 nodes with controller role
3. Add 2 nodes with compute+ceph role
4. Add 1 node with ceph role
5. Run network verification
6. Deploy the cluster
7. Run network verification
8. Ensure that openstack packages were taken from UCA repository
9. Run OSTF
Duration 60m
"""
self.env.revert_snapshot("ready_with_5_slaves")
self.env.bootstrap_nodes([self.env.d_env.get_node(name='slave-06')])
cluster_settings = {
'net_provider': settings.NEUTRON,
'net_segment_type': settings.NEUTRON_SEGMENT['tun'],
'uca_enabled': True,
'volumes_lvm': False,
'volumes_ceph': True,
'images_ceph': True,
'objects_ceph': True,
'ephemeral_ceph': True
}
self.show_step(1)
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=settings.DEPLOYMENT_MODE,
release_name=settings.OPENSTACK_RELEASE_UBUNTU_UCA,
settings=cluster_settings
)
self.show_step(2)
self.show_step(3)
self.show_step(4)
self.fuel_web.update_nodes(
cluster_id,
{
'slave-01': ['controller'],
'slave-02': ['controller'],
'slave-03': ['controller'],
'slave-04': ['compute', 'ceph-osd'],
'slave-05': ['compute', 'ceph-osd'],
'slave-06': ['ceph-osd']
}
)
self.show_step(5)
self.fuel_web.verify_network(cluster_id)
self.show_step(6)
self.fuel_web.deploy_cluster_wait(cluster_id)
self.show_step(7)
self.fuel_web.verify_network(cluster_id)
self.show_step(8)
uca_repo = self.get_uca_repo(cluster_id)
assert_is_not_none(uca_repo, "UCA repo was not found!")
for node in self.fuel_web.client.list_cluster_nodes(cluster_id):
logger.info("Checking packages on node {!r}".format(node['name']))
packages = self.get_os_packages(node['ip'])
for package in packages:
self.check_package_origin(node['ip'], package, uca_repo)
self.show_step(9)
self.fuel_web.run_ostf(cluster_id=cluster_id)
@test(depends_on=[SetupEnvironment.prepare_slaves_9],
groups=["uca_vlan_mongo"])
@log_snapshot_after_test
def uca_vlan_mongo(self):
"""Deploy cluster with NeutronVlan, Ceilometer and UCA repo
Scenario:
1. Create cluster using UCA release, Ceph for images and objects
2. Add 3 nodes with controller+mongo role
3. Add 1 node with compute+cinder role
4. Add 3 nodes with ceph-osd role
5. Run network verification
6. Deploy the cluster
7. Run network verification
8. Ensure that openstack packages were taken from UCA repository
9. Run OSTF
Duration 60m
"""
self.env.revert_snapshot("ready_with_9_slaves")
cluster_settings = {
'net_provider': settings.NEUTRON,
'net_segment_type': settings.NEUTRON_SEGMENT['vlan'],
'uca_enabled': True,
'images_ceph': True,
'objects_ceph': True,
}
self.show_step(1)
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=settings.DEPLOYMENT_MODE,
release_name=settings.OPENSTACK_RELEASE_UBUNTU_UCA,
settings=cluster_settings
)
self.show_step(2)
self.show_step(3)
self.show_step(4)
self.fuel_web.update_nodes(
cluster_id,
{
'slave-01': ['controller', 'mongo'],
'slave-02': ['controller', 'mongo'],
'slave-03': ['controller', 'mongo'],
'slave-04': ['compute', 'cinder'],
'slave-05': ['ceph-osd'],
'slave-06': ['ceph-osd'],
'slave-07': ['ceph-osd']
}
)
self.show_step(5)
self.fuel_web.verify_network(cluster_id)
self.show_step(6)
self.fuel_web.deploy_cluster_wait(cluster_id)
self.show_step(7)
self.fuel_web.verify_network(cluster_id)
self.show_step(8)
uca_repo = self.get_uca_repo(cluster_id)
assert_is_not_none(uca_repo, "UCA repo was not found!")
for node in self.fuel_web.client.list_cluster_nodes(cluster_id):
logger.info("Checking packages on node {!r}".format(node['name']))
packages = self.get_os_packages(node['ip'])
for package in packages:
self.check_package_origin(node['ip'], package, uca_repo)
self.show_step(9)
self.fuel_web.run_ostf(cluster_id=cluster_id)