Update decorator "update_ostf"
- make updating of ostf-server code via package not via the patch - add test gate_ostf_update Next variables should be exported: UPDATE_FUEL=True UPDATE_FUEL_PATH=/path/to/dir/with/package Change-Id: I53a768dfb4f755ab1b59db822ce571e00a0b2cb0 Closes-Bug: #1517487
This commit is contained in:
parent
e98ef8cb59
commit
44188db9c6
|
@ -23,7 +23,6 @@ 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
|
||||
|
@ -309,41 +308,6 @@ 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'])
|
||||
|
|
|
@ -43,7 +43,6 @@ 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
|
||||
|
@ -396,7 +395,6 @@ class FuelWebClient(object):
|
|||
|
||||
@logwrap
|
||||
@upload_manifests
|
||||
@update_ostf
|
||||
@update_fuel
|
||||
def create_cluster(self,
|
||||
name,
|
||||
|
@ -2400,3 +2398,8 @@ class FuelWebClient(object):
|
|||
logger.info('Spawn VMs of a cluster %s', cluster_id)
|
||||
task = self.client.spawn_vms(cluster_id)
|
||||
self.assert_task_success(task, timeout=timeout, interval=interval)
|
||||
|
||||
@logwrap
|
||||
def get_all_ostf_set_names(self, cluster_id):
|
||||
sets = self.client.get_ostf_test_sets(cluster_id)
|
||||
return [s['id'] for s in sets]
|
||||
|
|
|
@ -142,6 +142,7 @@ def import_tests():
|
|||
from gates_tests.tests import test_review_in_fuel_agent # 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
|
||||
|
||||
|
||||
def run_tests():
|
||||
|
|
|
@ -268,7 +268,6 @@ 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')
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# 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
|
|
@ -12,10 +12,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
|
||||
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
|
||||
|
@ -110,3 +113,64 @@ 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'
|
||||
full_pack_path = os.path.join(pack_path, '*.rpm')
|
||||
|
||||
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 = "rpm -Uvh --oldpackage {0}".format(
|
||||
full_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 = "rpm -qp {0}".format(full_pack_path)
|
||||
new_package = \
|
||||
environment.base_actions.execute_in_container(
|
||||
cmd, container)
|
||||
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)
|
||||
cmd = "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8777"
|
||||
helpers.wait(
|
||||
lambda: "401" in environment.base_actions.execute_in_container(
|
||||
cmd, container), timeout=60)
|
||||
logger.info("OSTF status: RUNNING")
|
||||
except Exception as e:
|
||||
logger.error("Could not update OSTF: {e}".format(e=e))
|
||||
raise
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
# 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 SkipTest
|
||||
from proboscis import test
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test import settings
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
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=[SetupEnvironment.prepare_release],
|
||||
groups=["gate_ostf_ceph_ha"])
|
||||
@log_snapshot_after_test
|
||||
def gate_ostf_ceph_ha(self):
|
||||
"""Deploy ceph with cinder in HA mode
|
||||
|
||||
Scenario:
|
||||
1. Create cluster
|
||||
2. Add 3 nodes with controller and ceph OSD roles
|
||||
3. Add 1 node with ceph OSD roles
|
||||
4. Add 2 nodes with compute and ceph OSD roles
|
||||
5. Deploy the cluster
|
||||
6. Run OSTF
|
||||
|
||||
Duration 90m
|
||||
Snapshot gate_ostf_ceph_ha
|
||||
|
||||
"""
|
||||
self.check_run('gate_ostf_ceph_ha')
|
||||
|
||||
self.env.revert_snapshot("ready")
|
||||
self.env.bootstrap_nodes(
|
||||
self.env.d_env.nodes().slaves[:6])
|
||||
csettings = {}
|
||||
csettings.update(
|
||||
{
|
||||
'volumes_ceph': True,
|
||||
'images_ceph': True,
|
||||
'objects_ceph': True,
|
||||
'ephemeral_ceph': True,
|
||||
'volumes_lvm': False,
|
||||
'osd_pool_size': "3",
|
||||
'tenant': 'ceph1',
|
||||
'user': 'ceph1',
|
||||
'password': 'ceph1'
|
||||
}
|
||||
)
|
||||
cluster_id = self.fuel_web.create_cluster(
|
||||
name=self.__class__.__name__,
|
||||
mode=settings.DEPLOYMENT_MODE,
|
||||
settings=csettings
|
||||
)
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-01': ['controller', 'ceph-osd'],
|
||||
'slave-02': ['controller', 'ceph-osd'],
|
||||
'slave-03': ['controller', 'ceph-osd'],
|
||||
'slave-04': ['compute', 'ceph-osd'],
|
||||
'slave-05': ['compute', 'ceph-osd'],
|
||||
'slave-06': ['ceph-osd']
|
||||
}
|
||||
)
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
|
||||
self.fuel_web.run_ostf(
|
||||
cluster_id=cluster_id,
|
||||
test_sets=self.fuel_web.get_all_ostf_set_names(cluster_id))
|
||||
|
||||
self.env.make_snapshot("gate_ostf_ceph_ha", is_make=True)
|
||||
|
||||
@test(depends_on=[gate_ostf_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 "gate_ostf_ceph_ha"
|
||||
2. Update ostf
|
||||
3. Run ostf
|
||||
|
||||
Duration 35m
|
||||
|
||||
"""
|
||||
if not settings.UPDATE_FUEL:
|
||||
raise exceptions.ConfigurationException(
|
||||
'Variable "UPDATE_FUEL" was not set to true')
|
||||
self.show_step(1)
|
||||
if not self.env.revert_snapshot(
|
||||
'gate_ostf_ceph_ha'):
|
||||
raise SkipTest()
|
||||
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=self.fuel_web.get_all_ostf_set_names(cluster_id))
|
Loading…
Reference in New Issue