Revert "Update decorator "update_ostf""

This reverts commit d24ff288ee.
Looks like import CephHA test class directly leads to 
double case execution(ceph_radosgw), so lets revert the patch to unblock CI 
Change-Id: Ifd6ca4afa77f3a5462401e5ff4155bbba408aa0a
This commit is contained in:
tatyana-leontovich 2015-12-08 21:26:02 +00:00
parent 745099d058
commit e80205d879
8 changed files with 43 additions and 134 deletions

View File

@ -23,6 +23,7 @@ import time
import traceback
from urlparse import urlparse
from devops.helpers import helpers
from fuelweb_test.helpers.checkers import check_action_logs
from fuelweb_test.helpers.checkers import check_repo_managment
from fuelweb_test.helpers.checkers import check_stats_on_collector
@ -308,6 +309,41 @@ def revert_info(snapshot_name, master_ip, description=""):
logger.info("<" * 5 + "*" * 100 + ">" * 5)
def update_ostf(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
result = func(*args, **kwargs)
try:
if settings.UPLOAD_PATCHSET:
if not settings.GERRIT_REFSPEC:
raise ValueError('REFSPEC should be set for CI tests.')
logger.info("Uploading new patchset from {0}"
.format(settings.GERRIT_REFSPEC))
with args[0].environment.d_env.get_admin_remote() as remote:
remote.upload(settings.PATCH_PATH.rstrip('/'),
'/var/www/nailgun/fuel-ostf')
remote.execute('dockerctl shell ostf '
'bash -c "cd /var/www/nailgun/fuel-ostf; '
'python setup.py develop"')
if MASTER_IS_CENTOS7:
remote.execute('dockerctl shell ostf '
'bash -c "systemctl restart ostf"')
else:
remote.execute('dockerctl shell ostf '
'bash -c "supervisorctl restart ostf"')
helpers.wait(
lambda: "0" in
remote.execute('dockerctl shell ostf '
'bash -c "pgrep [o]stf; echo $?"')
['stdout'][1], timeout=60)
logger.info("OSTF status: RUNNING")
except Exception as e:
logger.error("Could not upload patch set {e}".format(e=e))
raise
return result
return wrapper
def create_diagnostic_snapshot(env, status, name=""):
task = env.fuel_web.task_wait(env.fuel_web.client.generate_logs(), 60 * 10)
url = "http://{}:8000{}".format(env.get_admin_node_ip(), task['message'])

View File

@ -43,6 +43,7 @@ from fuelweb_test.helpers.decorators import download_packages_json
from fuelweb_test.helpers.decorators import duration
from fuelweb_test.helpers.decorators import retry
from fuelweb_test.helpers.decorators import update_fuel
from fuelweb_test.helpers.decorators import update_ostf
from fuelweb_test.helpers.decorators import upload_manifests
from fuelweb_test.helpers import replace_repos
from fuelweb_test.helpers.security import SecurityChecks
@ -395,6 +396,7 @@ class FuelWebClient(object):
@logwrap
@upload_manifests
@update_ostf
@update_fuel
def create_cluster(self,
name,

View File

@ -140,7 +140,6 @@ def import_tests():
from system_test.tests.plugins.plugin_example import test_plugin_example_v3 # noqa
from gates_tests.tests import test_review_in_fuel_agent # noqa
from tests.tests_strength import test_load # noqa
from gates_tests.tests import test_review_in_ostf # noqa
def run_tests():

View File

@ -266,6 +266,7 @@ UPLOAD_MANIFESTS_PATH = os.environ.get(
SITEPP_FOR_UPLOAD = os.environ.get(
'SITEPP_PATH', '/etc/puppet/modules/osnailyfacter/examples/site.pp')
UPLOAD_PATCHSET = get_var_as_bool('UPLOAD_PATCHSET', False)
GERRIT_REFSPEC = os.environ.get('GERRIT_REFSPEC')
PATCH_PATH = os.environ.get(
'PATCH_PATH', '/tmp/fuel-ostf')

View File

@ -242,8 +242,10 @@ class CephHA(TestBasic):
Snapshot ceph_ha
"""
if self.env.d_env.has_snapshot('ceph_ha'):
raise SkipTest("Test 'ceph_ha' has already ran")
try:
self.check_run('ceph_ha')
except SkipTest:
return
self.env.revert_snapshot("ready")
self.env.bootstrap_nodes(

View File

@ -1,17 +0,0 @@
# 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.
class ConfigurationException(Exception):
pass

View File

@ -15,9 +15,7 @@
from proboscis.asserts import assert_equal
from devops.helpers import helpers
from fuelweb_test.helpers import checkers
from gates_tests.helpers import exceptions
from fuelweb_test import logger
from fuelweb_test import settings
@ -112,59 +110,3 @@ def replace_bootstrap(environment):
except Exception as e:
logger.error("Could not upload package {e}".format(e=e))
raise
def update_ostf(environment):
try:
if not settings.UPDATE_FUEL:
raise exceptions.ConfigurationException(
'Variable "UPDATE_FUEL" was not set to true')
logger.info("Uploading new package from {0}"
.format(settings.UPDATE_FUEL_PATH))
pack_path = '/var/www/nailgun/fuel-ostf/'
container = 'ostf'
with environment.d_env.get_admin_remote() as remote:
remote.upload(settings.UPDATE_FUEL_PATH.rstrip('/'),
pack_path)
cmd = "service ostf stop"
environment.base_actions.execute_in_container(
cmd, container)
cmd = "service ostf status"
helpers.wait(
lambda: "dead" in
environment.base_actions.execute_in_container(
cmd, container),
timeout=60)
logger.info("OSTF status: inactive")
cmd = "rpm -e fuel-ostf"
environment.base_actions.execute_in_container(
cmd, container, exit_code=0)
cmd = "yum localinstall -y {0}fuel-ostf*.rpm".format(
pack_path)
environment.base_actions.execute_in_container(
cmd, container, exit_code=0)
cmd = "rpm -q fuel-ostf"
installed_package = \
environment.base_actions.execute_in_container(
cmd, container)
cmd = "ls -1 {0}".format(pack_path)
new_package = \
environment.base_actions.execute_in_container(
cmd, container).rstrip('.rpm')
assert_equal(installed_package, new_package,
"The new package {0} was not installed".
format(new_package))
cmd = "service ostf start"
environment.base_actions.execute_in_container(
cmd, container)
cmd = "service ostf status"
helpers.wait(
lambda: "running" in
environment.base_actions.execute_in_container(
cmd, container, exit_code=0),
timeout=60)
logger.info("OSTF status: RUNNING")
except Exception as e:
logger.error("Could not upload package {e}".format(e=e))
raise

View File

@ -1,56 +0,0 @@
# 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 UPDATE_FUEL
from fuelweb_test.tests.base_test_case import TestBasic
from fuelweb_test.tests.test_ceph import CephHA
from gates_tests.helpers import exceptions
from gates_tests.helpers.utils import update_ostf
@test(groups=["gate_ostf"])
class GateOstf(TestBasic):
"""Update fuel-ostf in ostf container,
Check how it works on pre deployed cluster
Executes for each review in openstack/fuel-ostf"""
@test(depends_on=[CephHA.ceph_ha],
groups=["gate_ostf_update"])
@log_snapshot_after_test
def gate_ostf_update(self):
""" Update ostf start on deployed cluster
Scenario:
1. Revert snapshot "ceph_ha"
2. Update ostf
3. Run ostf
Duration 35m
"""
if not UPDATE_FUEL:
raise exceptions.ConfigurationException(
'Variable "UPDATE_FUEL" was not set to true')
self.show_step(1)
self.env.revert_snapshot("ceph_ha")
self.show_step(2)
update_ostf(self.env)
cluster_id = self.fuel_web.get_last_created_cluster()
self.show_step(3)
self.fuel_web.run_ostf(
cluster_id=cluster_id,
test_sets=['ha', 'smoke', 'sanity'])