Add gate test for fuel web

Add gate test for python fuelweb  that should be executed
for each review in openstack/python-fuelweb repo.

Next variables should be exported:
UPDATE_FUEL=true
UPDATE_FUEL_PATH=/path/to/source

Test depends on empty,
so it is better to run it with -k option.
test_group: review_fuel_web_deploy
Scenario:
 1. Revert snapshot "empty"
 2. Apply changes into nailgun
 3. Get release id
 4. Update networks
 5. Bootstrap 3 nodes
 6. Create cluster
 7. Add 1 controller nodes
 8. Add 1 compute node
 9. Add 1 cinder node
 10. Deploy environment
 11. Run OSTF

Change-Id: I69ab8b657e996bec74333900f8a5e6d521c0743c
This commit is contained in:
Tatyana Leontovich 2015-12-08 13:12:49 +02:00 committed by tatyana-leontovich
parent 39ae529491
commit 83cd865771
3 changed files with 170 additions and 2 deletions

View File

@ -126,6 +126,7 @@ def import_tests():
from system_test.tests.plugins.plugin_example import test_plugin_example_v3 # noqa
from system_test.tests.vcenter import test_vcenter_dvs # noqa
from gates_tests.tests import test_review_in_fuel_agent # noqa
from gates_tests.tests import test_review_fuel_web # noqa
from tests.tests_strength import test_load # noqa
from tests import test_services_reconfiguration # noqa
from gates_tests.tests import test_review_in_ostf # noqa

View File

@ -30,8 +30,7 @@ def replace_fuel_agent_rpm(environment):
"""
logger.info("Patching fuel-agent")
if not settings.UPDATE_FUEL:
raise Exception("{} variable don't exist"
.format(settings.UPDATE_FUEL))
raise exceptions.FuelQAVariableNotSet('UPDATE_FUEL', 'True')
try:
pack_path = '/var/www/nailgun/fuel-agent/'
container = 'mcollective'
@ -303,3 +302,82 @@ def update_ostf(environment):
except Exception as e:
logger.error("Could not update OSTF: {e}".format(e=e))
raise
def replace_fuel_nailgun_rpm(environment):
"""
Replace fuel_nailgun*.rpm from review
environment - Environment Model object - self.env
"""
logger.info("Patching fuel-nailgun")
if not settings.UPDATE_FUEL:
raise exceptions.FuelQAVariableNotSet('UPDATE_FUEL', 'True')
try:
pack_path = '/var/www/nailgun/fuel-nailgun/'
container = 'nailgun'
with environment.d_env.get_admin_remote() as remote:
remote.upload(settings.UPDATE_FUEL_PATH.rstrip('/'),
pack_path)
# stop services
service_list = ['assassind', 'receiverd',
'nailgun', 'oswl_*', 'statsenderd']
[environment.base_actions.execute_in_container(
'systemctl stop {0}'.format(service),
container, exit_code=0) for service in service_list]
# Update fuel-nailgun in nailgun
cmd = "rpm -q fuel-nailgun"
try:
old_package = \
environment.base_actions.execute_in_container(
cmd, container, exit_code=0)
logger.info("Delete package {0}"
.format(old_package))
except AssertionError:
if 'fuel-nailgun is not installed' in AssertionError.message:
old_package = None
else:
raise AssertionError
# Drop nailgun db manage.py dropdb
cmd = 'manage.py dropdb'
environment.base_actions.execute_in_container(
cmd, container, exit_code=0)
cmd = "rpm -e fuel-nailgun"
environment.base_actions.execute_in_container(
cmd, container, exit_code=0)
cmd = "ls -1 {0}|grep 'fuel-nailgun'".format(pack_path)
new_package = \
environment.base_actions.execute_in_container(
cmd, container).rstrip('.rpm')
logger.info("Install package {0}"
.format(new_package))
cmd = "yum localinstall -y {0}fuel-nailgun*.rpm".format(
pack_path)
environment.base_actions.execute_in_container(
cmd, container, exit_code=0)
cmd = "rpm -q fuel-nailgun"
installed_package = \
environment.base_actions.execute_in_container(
cmd, container, exit_code=0)
if old_package:
assert_equal(installed_package, new_package,
"The new package {0} was not installed".
format(new_package))
cmd = ('puppet apply --debug'
' /etc/puppet/modules/nailgun/examples/nailgun-only.pp')
environment.base_actions.execute_in_container(
cmd, container, exit_code=0)
with environment.d_env.get_admin_remote() as remote:
res = remote.execute("fuel release --sync-deployment-tasks"
" --dir /etc/puppet/")
assert_equal(res['exit_code'], 0,
'Failed to sync tasks with result {0}'.format(res))
except Exception as e:
logger.error("Could not upload package {e}".format(e=e))
raise

View File

@ -0,0 +1,89 @@
# Copyright 2015 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 import test
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.settings import OPENSTACK_RELEASE
from fuelweb_test.settings import UPDATE_FUEL
from fuelweb_test.tests.base_test_case import TestBasic
from fuelweb_test.tests.base_test_case import SetupEnvironment
from fuelweb_test.helpers.utils import run_on_remote
from gates_tests.helpers import exceptions
from gates_tests.helpers.utils import replace_fuel_nailgun_rpm
@test(groups=['review_fuel_web'])
class GateFuelWeb(TestBasic):
"""Using in fuel-web CI-gates
Update fuel-web packages during installation
of master node, deploy environment"""
@test(depends_on=[SetupEnvironment.setup_master],
groups=["review_fuel_web_deploy"])
@log_snapshot_after_test
def gate_fuel_web(self):
"""
Scenario:
1. Revert snapshot "empty"
2. Apply changes into nailgun
3. Get release id
4. Update networks
5. Bootstrap 3 nodes
6. Create cluster
7. Add 1 controller nodes
8. Add 1 compute node
9. Add 1 cinder node
10. Deploy environment
11. Run OSTF
"""
if not UPDATE_FUEL:
raise exceptions.FuelQAVariableNotSet('UPDATE_FUEL', 'True')
self.show_step(1)
self.env.revert_snapshot("empty")
self.show_step(2)
replace_fuel_nailgun_rpm(self.env)
self.show_step(3)
release_id = self.fuel_web.get_releases_list_for_os(
release_name=OPENSTACK_RELEASE)[0]
self.show_step(4)
self.fuel_web.change_default_network_settings()
self.show_step(5)
self.env.bootstrap_nodes(
self.env.d_env.nodes().slaves[:3])
self.show_step(6)
with self.env.d_env.get_admin_remote() as remote:
cmd = ('fuel env create --name={0} --release={1} '
'--nst=tun --json'.format(self.__class__.__name__,
release_id))
env_result = run_on_remote(remote, cmd, jsonify=True)
cluster_id = env_result['id']
self.show_step(7)
self.show_step(8)
self.show_step(9)
self.fuel_web.update_nodes(
cluster_id,
{
'slave-01': ['controller'],
'slave-02': ['compute'],
'slave-03': ['cinder'],
}
)
self.show_step(10)
self.fuel_web.deploy_cluster_wait(cluster_id)
self.show_step(11)
# run only smoke according to sanity and ha ran in deploy_wait()
self.fuel_web.run_ostf(cluster_id=cluster_id,
test_sets=['smoke'])