Refactoring of setup_master method, get_setup method, setup_master action
Change-Id: Ib6bc673345f4337c11a7af45f58c217fe0272c39 Related-Bug: #1604410
This commit is contained in:
parent
56cced4df7
commit
63ee810635
|
@ -17,19 +17,14 @@
|
|||
from six.moves import xrange
|
||||
# pylint: enable=redefined-builtin
|
||||
|
||||
from devops.helpers.helpers import wait
|
||||
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test import settings
|
||||
from fuelweb_test.helpers.fuel_release_hacks import install_mos_repos
|
||||
from fuelweb_test.helpers.decorators import create_diagnostic_snapshot
|
||||
from fuelweb_test.helpers.utils import TimeStat
|
||||
from fuelweb_test.tests.base_test_case import TestBasic as Basic
|
||||
|
||||
from system_test.core.discover import load_yaml
|
||||
|
||||
from gates_tests.helpers import exceptions
|
||||
|
||||
|
||||
class Manager(Basic):
|
||||
"""Manager class for tests."""
|
||||
|
@ -194,7 +189,7 @@ class Manager(Basic):
|
|||
if 'devops_settings' in config['template']:
|
||||
self._devops_config = config
|
||||
|
||||
def get_ready_setup(self, centos=settings.CENTOS_MASTER_NODE):
|
||||
def get_ready_setup(self):
|
||||
"""Create virtual environment and install Fuel master node.
|
||||
"""
|
||||
|
||||
|
@ -203,36 +198,20 @@ class Manager(Basic):
|
|||
self.env.revert_snapshot("empty")
|
||||
return True
|
||||
else:
|
||||
if centos:
|
||||
""" Need to export CENTOS_CLOUD_IMAGE_PATH,
|
||||
FUEL_RELEASE_PATH and EXTRA_DEB_REPOS environment variables"""
|
||||
if not settings.EXTRA_DEB_REPOS:
|
||||
raise exceptions.FuelQAVariableNotSet(
|
||||
settings.EXTRA_DEB_REPOS,
|
||||
"deb mos repo for building cluster")
|
||||
|
||||
with TimeStat("centos_setup_environment", is_uniq=True):
|
||||
admin = self.env.d_env.nodes().admin
|
||||
self.env.d_env.start([admin])
|
||||
logger.info("Waiting for Centos node to start up")
|
||||
wait(lambda: admin.driver.node_active(admin), 60)
|
||||
logger.info("Waiting for Centos node ssh ready")
|
||||
self.env.wait_for_provisioning()
|
||||
hostname = ''.join((settings.FUEL_MASTER_HOSTNAME,
|
||||
settings.DNS_SUFFIX))
|
||||
install_mos_repos()
|
||||
self.centos_setup_fuel(hostname)
|
||||
self.fuel_post_install_actions(
|
||||
force_ssl=settings.FORCE_HTTPS_MASTER_NODE)
|
||||
|
||||
self.env.make_snapshot("empty", is_make=True)
|
||||
self.env.resume_environment()
|
||||
return True
|
||||
else:
|
||||
with TimeStat("setup_environment", is_uniq=True):
|
||||
with TimeStat("setup_environment", is_uniq=True):
|
||||
if list(self.env.d_env.get_nodes(role='fuel_master')):
|
||||
self.env.setup_environment()
|
||||
self.fuel_post_install_actions()
|
||||
|
||||
elif list(self.env.d_env.get_nodes(role='centos_master')):
|
||||
# need to use centos_master.yaml devops template
|
||||
hostname = ''.join((settings.FUEL_MASTER_HOSTNAME,
|
||||
settings.DNS_SUFFIX))
|
||||
self.centos_setup_fuel(hostname)
|
||||
else:
|
||||
raise RuntimeError(
|
||||
"No Fuel master nodes found!")
|
||||
|
||||
self.env.make_snapshot("empty", is_make=True)
|
||||
self.env.resume_environment()
|
||||
return True
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
import time
|
||||
|
||||
from devops.helpers.helpers import wait
|
||||
|
||||
from proboscis import TestProgram
|
||||
from proboscis import SkipTest
|
||||
from proboscis import test
|
||||
|
@ -21,6 +23,7 @@ from proboscis import test
|
|||
from fuelweb_test import logger
|
||||
from fuelweb_test import settings
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.helpers.fuel_release_hacks import install_mos_repos
|
||||
from fuelweb_test.helpers.utils import erase_data_from_hdd
|
||||
from fuelweb_test.helpers.utils import get_test_method_name
|
||||
from fuelweb_test.helpers.utils import TimeStat
|
||||
|
@ -274,6 +277,15 @@ class TestBasic(object):
|
|||
self.fuel_post_install_actions()
|
||||
|
||||
def centos_setup_fuel(self, hostname):
|
||||
with TimeStat("bootstrap_centos_node", is_uniq=True):
|
||||
admin = list(self.env.d_env.get_nodes(role__contains='master'))[0]
|
||||
self.env.d_env.start([admin])
|
||||
logger.info("Waiting for Centos node to start up")
|
||||
wait(lambda: admin.driver.node_active(admin), 60,
|
||||
timeout_msg='Centos node failed to start')
|
||||
logger.info("Waiting for Centos node ssh ready")
|
||||
self.env.wait_for_provisioning()
|
||||
|
||||
ssh = SSHManager()
|
||||
logger.debug("Update host information")
|
||||
cmd = "echo HOSTNAME={} >> /etc/sysconfig/network".format(hostname)
|
||||
|
@ -292,6 +304,8 @@ class TestBasic(object):
|
|||
cmd = "yum install -y screen"
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
|
||||
install_mos_repos()
|
||||
|
||||
logger.info("Install Fuel services")
|
||||
|
||||
cmd = "screen -dm bash -c 'showmenu=no wait_for_external_config=yes " \
|
||||
|
@ -335,8 +349,21 @@ class SetupEnvironment(TestBasic):
|
|||
self.check_run("empty")
|
||||
|
||||
with TimeStat("setup_environment", is_uniq=True):
|
||||
self.env.setup_environment()
|
||||
self.fuel_post_install_actions()
|
||||
|
||||
if list(self.env.d_env.get_nodes(role='fuel_master')):
|
||||
self.env.setup_environment()
|
||||
self.fuel_post_install_actions()
|
||||
|
||||
elif list(self.env.d_env.get_nodes(role='centos_master')):
|
||||
# need to use centos_master.yaml devops template
|
||||
hostname = ''.join((settings.FUEL_MASTER_HOSTNAME,
|
||||
settings.DNS_SUFFIX))
|
||||
self.centos_setup_fuel(hostname)
|
||||
|
||||
else:
|
||||
raise SkipTest(
|
||||
"No Fuel master nodes found!")
|
||||
|
||||
self.env.make_snapshot("empty", is_make=True)
|
||||
self.current_log_step = 0
|
||||
|
||||
|
|
|
@ -14,11 +14,9 @@
|
|||
|
||||
from __future__ import division
|
||||
|
||||
import os
|
||||
import time
|
||||
import itertools
|
||||
|
||||
from devops.helpers.helpers import wait
|
||||
|
||||
from proboscis import SkipTest
|
||||
from proboscis.asserts import assert_equal
|
||||
|
@ -28,9 +26,7 @@ from proboscis.asserts import assert_true
|
|||
from six.moves import xrange
|
||||
# pylint: enable=redefined-builtin
|
||||
|
||||
import fuelweb_test
|
||||
from fuelweb_test.helpers import checkers
|
||||
from fuelweb_test.helpers.cloud_image import generate_cloud_image_settings
|
||||
from fuelweb_test.helpers.utils import TimeStat
|
||||
from fuelweb_test import settings
|
||||
|
||||
|
@ -121,65 +117,19 @@ class PrepareActions(object):
|
|||
"""Setup master node"""
|
||||
self.check_run("empty")
|
||||
with TimeStat("setup_environment", is_uniq=True):
|
||||
self.env.setup_environment()
|
||||
self.fuel_post_install_actions()
|
||||
if list(self.env.d_env.get_nodes(role='fuel_master')):
|
||||
self.env.setup_environment()
|
||||
self.fuel_post_install_actions()
|
||||
|
||||
self.env.make_snapshot("empty", is_make=True)
|
||||
elif list(self.env.d_env.get_nodes(role='centos_master')):
|
||||
# need to use centos_master.yaml devops template
|
||||
hostname = ''.join((settings.FUEL_MASTER_HOSTNAME,
|
||||
settings.DNS_SUFFIX))
|
||||
self.centos_setup_fuel(hostname)
|
||||
|
||||
@deferred_decorator([make_snapshot_if_step_fail])
|
||||
@action
|
||||
def setup_centos_master(self):
|
||||
"""Create environment, bootstrap centos_master
|
||||
and install fuel services
|
||||
|
||||
Snapshot "empty_centos"
|
||||
|
||||
1. bootstrap_centos_master
|
||||
2. Download fuel_release from remote repository
|
||||
3. install fuel_setup package
|
||||
4. Install Fuel services by executing bootstrap_admin_node.sh
|
||||
5. check Fuel services
|
||||
|
||||
|
||||
"""
|
||||
self.check_run("empty_centos")
|
||||
self.show_step(1, initialize=True)
|
||||
cloud_image_settings_path = os.path.join(
|
||||
os.path.dirname(fuelweb_test.__file__),
|
||||
'cloud_image_settings/cloud_settings.iso')
|
||||
|
||||
admin_net_object = self.env.d_env.get_network(
|
||||
name=self.env.d_env.admin_net)
|
||||
admin_network = admin_net_object.ip.network
|
||||
admin_netmask = admin_net_object.ip.netmask
|
||||
admin_ip = str(self.env.d_env.nodes(
|
||||
).admin.get_ip_address_by_network_name(self.env.d_env.admin_net))
|
||||
interface_name = settings.iface_alias("eth0")
|
||||
gateway = self.env.d_env.router()
|
||||
dns = settings.DNS
|
||||
dns_ext = ''.join(settings.EXTERNAL_DNS)
|
||||
hostname = ''.join((settings.FUEL_MASTER_HOSTNAME,
|
||||
settings.DNS_SUFFIX))
|
||||
user = settings.SSH_FUEL_CREDENTIALS['login']
|
||||
password = settings.SSH_FUEL_CREDENTIALS['password']
|
||||
generate_cloud_image_settings(cloud_image_settings_path, admin_network,
|
||||
interface_name, admin_ip, admin_netmask,
|
||||
gateway, dns, dns_ext,
|
||||
hostname, user, password)
|
||||
|
||||
with TimeStat("bootstrap_centos_node", is_uniq=True):
|
||||
admin = self.env.d_env.nodes().admin
|
||||
logger.info(cloud_image_settings_path)
|
||||
admin.disk_devices.get(
|
||||
device='cdrom').volume.upload(cloud_image_settings_path)
|
||||
self.env.d_env.start([admin])
|
||||
logger.info("Waiting for Centos node to start up")
|
||||
wait(lambda: admin.driver.node_active(admin), 60,
|
||||
timeout_msg='Centos node failed to start')
|
||||
logger.info("Waiting for Centos node ssh ready")
|
||||
self.env.wait_for_provisioning()
|
||||
|
||||
self.centos_setup_fuel(hostname)
|
||||
else:
|
||||
raise SkipTest(
|
||||
"No Fuel master nodes found!")
|
||||
|
||||
self.env.make_snapshot("empty", is_make=True)
|
||||
|
||||
|
|
|
@ -92,7 +92,3 @@ def define_custom_groups():
|
|||
add_group(group="fuel_master_migrate",
|
||||
systest_group="system_test.fuel_migration",
|
||||
config_name="1ctrl_1comp_neutronTUN")
|
||||
|
||||
add_group(group="system_test.deploy_centos_master",
|
||||
systest_group="system_test.centos_deploy_and_check_radosgw",
|
||||
config_name="centos_master_ceph_all_on_neutron_vlan")
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
# 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.
|
||||
|
||||
from proboscis.asserts import assert_true
|
||||
|
||||
from system_test import testcase
|
||||
from system_test import action
|
||||
from system_test import deferred_decorator
|
||||
|
||||
from system_test.tests import ActionTest
|
||||
from system_test.actions import BaseActions
|
||||
|
||||
from system_test.helpers.decorators import make_snapshot_if_step_fail
|
||||
|
||||
|
||||
@testcase(groups=['system_test',
|
||||
'system_test.centos_deploy_and_check_radosgw'])
|
||||
class CentosDeployCheckRadosGW(ActionTest, BaseActions):
|
||||
"""Deploy cluster and check RadosGW
|
||||
|
||||
Scenario:
|
||||
1. Bootstrap Centos node and install Fuel services
|
||||
2. Create Environment
|
||||
3. Add nodes to Environment
|
||||
4. Run network checker
|
||||
5. Deploy Environment
|
||||
6. Run network checker
|
||||
7. Check HAProxy backends
|
||||
8. Check ceph status
|
||||
9. Run OSTF
|
||||
10. Check the radosgw daemon is started
|
||||
|
||||
"""
|
||||
|
||||
actions_order = [
|
||||
'setup_centos_master',
|
||||
'config_release',
|
||||
'make_slaves',
|
||||
'revert_slaves',
|
||||
'create_env',
|
||||
'add_nodes',
|
||||
'network_check',
|
||||
'deploy_cluster',
|
||||
'network_check',
|
||||
'check_haproxy',
|
||||
'check_ceph_status',
|
||||
'health_check',
|
||||
'check_rados_daemon'
|
||||
]
|
||||
|
||||
@deferred_decorator([make_snapshot_if_step_fail])
|
||||
@action
|
||||
def check_ceph_status(self):
|
||||
"""Check Ceph status in cluster"""
|
||||
self.fuel_web.check_ceph_status(self.cluster_id)
|
||||
|
||||
@deferred_decorator([make_snapshot_if_step_fail])
|
||||
@action
|
||||
def check_rados_daemon(self):
|
||||
"""Check the radosgw daemon is started"""
|
||||
def radosgw_started(remote):
|
||||
return remote.check_call('pkill -0 radosgw')['exit_code'] == 0
|
||||
|
||||
with self.fuel_web.get_ssh_for_node('slave-01') as remote:
|
||||
assert_true(radosgw_started(remote), 'radosgw daemon started')
|
Loading…
Reference in New Issue