Merge "Add usage of SSHManager() in gate tests"
This commit is contained in:
commit
b340f64e94
@ -18,33 +18,33 @@ from proboscis.asserts import assert_equal
|
||||
from devops.helpers import helpers
|
||||
|
||||
from fuelweb_test.helpers import checkers
|
||||
from fuelweb_test.helpers.ssh_manager import SSHManager
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test import settings
|
||||
from gates_tests.helpers import exceptions
|
||||
|
||||
|
||||
def replace_fuel_agent_rpm(environment):
|
||||
def replace_fuel_agent_rpm():
|
||||
"""Replaced fuel_agent.rpm on master node with fuel_agent.rpm
|
||||
from review
|
||||
environment - Environment Model object - self.env
|
||||
"""
|
||||
ssh = SSHManager()
|
||||
logger.info("Patching fuel-agent")
|
||||
if not settings.UPDATE_FUEL:
|
||||
raise exceptions.FuelQAVariableNotSet('UPDATE_FUEL', 'True')
|
||||
try:
|
||||
pack_path = '/var/www/nailgun/fuel-agent/'
|
||||
full_pack_path = os.path.join(pack_path, 'fuel-agent*.noarch.rpm')
|
||||
with environment.d_env.get_admin_remote() as remote:
|
||||
remote.upload(settings.UPDATE_FUEL_PATH.rstrip('/'),
|
||||
pack_path)
|
||||
ssh.upload_to_remote(
|
||||
ip=ssh.admin_ip,
|
||||
source=settings.UPDATE_FUEL_PATH.rstrip('/'),
|
||||
target=pack_path)
|
||||
|
||||
# Update fuel-agent on master node
|
||||
cmd = "rpm -q fuel-agent"
|
||||
old_package = \
|
||||
environment.base_actions.execute(cmd, exit_code=0)
|
||||
old_package = ssh.execute_on_remote(ssh.admin_ip, cmd)['stdout_str']
|
||||
cmd = "rpm -qp {0}".format(full_pack_path)
|
||||
new_package = \
|
||||
environment.base_actions.execute(cmd)
|
||||
new_package = ssh.execute_on_remote(ssh.admin_ip, cmd)['stdout_str']
|
||||
logger.info("Updating package {0} with {1}"
|
||||
.format(old_package, new_package))
|
||||
|
||||
@ -53,11 +53,11 @@ def replace_fuel_agent_rpm(environment):
|
||||
logger.info('Try to install package {0}'.format(
|
||||
new_package))
|
||||
cmd = "rpm -Uvh --oldpackage {0}".format(full_pack_path)
|
||||
environment.base_actions.execute(cmd, exit_code=0)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd)
|
||||
|
||||
cmd = "rpm -q fuel-agent"
|
||||
installed_package = \
|
||||
environment.base_actions.execute(cmd, exit_code=0)
|
||||
installed_package = ssh.execute_on_remote(
|
||||
ssh.admin_ip, cmd)['stdout_str']
|
||||
|
||||
assert_equal(installed_package, new_package,
|
||||
"The new package {0} was not installed".
|
||||
@ -68,36 +68,31 @@ def replace_fuel_agent_rpm(environment):
|
||||
raise
|
||||
|
||||
|
||||
def patch_centos_bootstrap(environment):
|
||||
def patch_centos_bootstrap():
|
||||
"""Replaced initramfs.img in /var/www/nailgun/
|
||||
with newly_builded from review
|
||||
environment - Environment Model object - self.env
|
||||
"""
|
||||
logger.info("Update fuel-agent code and assemble new bootstrap")
|
||||
ssh = SSHManager()
|
||||
if not settings.UPDATE_FUEL:
|
||||
raise Exception("{} variable don't exist"
|
||||
.format(settings.UPDATE_FUEL))
|
||||
try:
|
||||
pack_path = '/var/www/nailgun/fuel-agent-review/'
|
||||
with environment.d_env.get_admin_remote() as remote:
|
||||
remote.upload(settings.FUEL_AGENT_REPO_PATH.rstrip('/'),
|
||||
pack_path)
|
||||
# renew code in bootstrap
|
||||
|
||||
ssh.upload_to_remote(
|
||||
ip=ssh.admin_ip,
|
||||
source=settings.FUEL_AGENT_REPO_PATH.rstrip('/'),
|
||||
target=pack_path)
|
||||
# Step 1 - unpack bootstrap
|
||||
bootstrap_var = "/var/initramfs"
|
||||
bootstrap = "/var/www/nailgun/bootstrap"
|
||||
cmd = ("mkdir {0};"
|
||||
"cp /{1}/initramfs.img {0}/;"
|
||||
"cd {0};"
|
||||
cmd = ("mkdir {0}; cp /{1}/initramfs.img {0}/; cd {0}; "
|
||||
"cat initramfs.img | gunzip | cpio -imudv;").format(
|
||||
bootstrap_var,
|
||||
bootstrap
|
||||
)
|
||||
result = remote.execute(cmd)
|
||||
assert_equal(result['exit_code'], 0,
|
||||
('Failed to add unpack bootstrap {}'
|
||||
).format(result))
|
||||
bootstrap_var, bootstrap)
|
||||
result = ssh.execute_on_remote(
|
||||
ip=ssh.admin_ip, cmd=cmd)['stdout_str']
|
||||
logger.debug("Patching bootsrap finishes with {0}".format(result))
|
||||
|
||||
# Step 2 - replace fuel-agent code in unpacked bootstrap
|
||||
agent_path = "/usr/lib/python2.7/site-packages/fuel_agent"
|
||||
@ -106,19 +101,15 @@ def patch_centos_bootstrap(environment):
|
||||
"cpio --create --format='newc'",
|
||||
"gzip -9 > /var/initramfs.img.updated")
|
||||
|
||||
cmd = ("rm -rf {0}/initramfs.img;"
|
||||
cmd = ("rm -rf {0}/initramfs.img; "
|
||||
"rsync -r {2}fuel_agent/* {0}{1}/;"
|
||||
"cd {0}/;"
|
||||
"{3};"
|
||||
).format(
|
||||
bootstrap_var,
|
||||
agent_path,
|
||||
pack_path,
|
||||
"{3};").format(bootstrap_var, agent_path, pack_path,
|
||||
image_rebuild)
|
||||
result = ssh.execute_on_remote(
|
||||
ip=ssh.admin_ip, cmd=cmd)['stdout_str']
|
||||
logger.debug("Failed to rebuild image with {0}".format(result))
|
||||
|
||||
result = remote.execute(cmd)
|
||||
assert_equal(result['exit_code'], 0,
|
||||
'Failed to rebuild bootstrap {}'.format(result))
|
||||
except Exception as e:
|
||||
logger.error("Could not upload package {e}".format(e=e))
|
||||
raise
|
||||
@ -130,50 +121,37 @@ def patch_and_assemble_ubuntu_bootstrap(environment):
|
||||
environment - Environment Model object - self.env
|
||||
"""
|
||||
logger.info("Update fuel-agent code and assemble new ubuntu bootstrap")
|
||||
ssh = SSHManager()
|
||||
if not settings.UPDATE_FUEL:
|
||||
raise Exception("{} variable don't exist"
|
||||
.format(settings.UPDATE_FUEL))
|
||||
try:
|
||||
pack_path = '/var/www/nailgun/fuel-agent-review/'
|
||||
with environment.d_env.get_admin_remote() as remote:
|
||||
remote.upload(settings.FUEL_AGENT_REPO_PATH.rstrip('/'),
|
||||
pack_path)
|
||||
ssh.upload_to_remote(
|
||||
ip=ssh.admin_ip,
|
||||
source=settings.FUEL_AGENT_REPO_PATH.rstrip('/'),
|
||||
target=pack_path)
|
||||
# renew code in bootstrap
|
||||
|
||||
# Step 1 - install squashfs-tools
|
||||
cmd = "yum install -y squashfs-tools"
|
||||
result = remote.execute(cmd)
|
||||
assert_equal(result['exit_code'], 0,
|
||||
('Failed to install squashfs-tools {}'
|
||||
).format(result))
|
||||
ssh.execute_on_remote(ip=ssh.admin_ip, cmd=cmd)
|
||||
|
||||
# Step 2 - unpack bootstrap
|
||||
bootstrap = "/var/www/nailgun/bootstraps/active_bootstrap"
|
||||
bootstrap_var = "/var/root.squashfs"
|
||||
|
||||
cmd = ("unsquashfs -d /var/root.squashfs {}/root.squashfs"
|
||||
).format(bootstrap)
|
||||
result = remote.execute(cmd)
|
||||
assert_equal(result['exit_code'], 0,
|
||||
('Failed to add unpack bootstrap {}'
|
||||
).format(result))
|
||||
cmd = "unsquashfs -d /var/root.squashfs {}/root.squashfs".format(
|
||||
bootstrap)
|
||||
ssh.execute_on_remote(ip=ssh.admin_ip, cmd=cmd)
|
||||
|
||||
# Step 3 - replace fuel-agent code in unpacked bootstrap
|
||||
agent_path = "/usr/lib/python2.7/dist-packages/fuel_agent"
|
||||
bootstrap_file = bootstrap + "/root.squashfs"
|
||||
cmd = ("rsync -r {2}fuel_agent/* {0}{1}/;"
|
||||
"mv {3} /var/root.squashfs.old;"
|
||||
).format(
|
||||
bootstrap_var,
|
||||
agent_path,
|
||||
pack_path,
|
||||
bootstrap_file
|
||||
)
|
||||
|
||||
result = remote.execute(cmd)
|
||||
assert_equal(result['exit_code'], 0,
|
||||
('Failed to replace fuel-agent code {}'
|
||||
).format(result))
|
||||
).format(bootstrap_var, agent_path, pack_path, bootstrap_file)
|
||||
ssh.execute_on_remote(ip=ssh.admin_ip, cmd=cmd)
|
||||
|
||||
# Step 4 - assemble new bootstrap
|
||||
compression = "-comp xz"
|
||||
@ -184,16 +162,10 @@ def patch_and_assemble_ubuntu_bootstrap(environment):
|
||||
bootstrap_file,
|
||||
compression,
|
||||
no_progress_bar,
|
||||
no_append
|
||||
)
|
||||
result = remote.execute(image_rebuild)
|
||||
assert_equal(result['exit_code'], 0,
|
||||
('Failed to rebuild bootstrap {}'
|
||||
).format(result))
|
||||
|
||||
checkers.check_file_exists(
|
||||
remote,
|
||||
'{0}'.format(bootstrap_file))
|
||||
no_append)
|
||||
ssh.execute_on_remote(ip=ssh.admin_ip, cmd=image_rebuild)
|
||||
with environment.d_env.get_admin_remote() as remote:
|
||||
checkers.check_file_exists(remote, '{0}'.format(bootstrap_file))
|
||||
except Exception as e:
|
||||
logger.error("Could not upload package {e}".format(e=e))
|
||||
raise
|
||||
@ -205,54 +177,45 @@ def replace_centos_bootstrap(environment):
|
||||
environment - Environment Model object - self.env
|
||||
"""
|
||||
logger.info("Updating bootstrap")
|
||||
ssh = SSHManager()
|
||||
if not settings.UPDATE_FUEL:
|
||||
raise Exception("{} variable don't exist"
|
||||
.format(settings.UPDATE_FUEL))
|
||||
try:
|
||||
|
||||
rebuilded_bootstrap = '/var/initramfs.img.updated'
|
||||
with environment.d_env.get_admin_remote() as remote:
|
||||
checkers.check_file_exists(
|
||||
remote,
|
||||
'{0}'.format(rebuilded_bootstrap))
|
||||
logger.info("Assigning new bootstrap from {}"
|
||||
.format(rebuilded_bootstrap))
|
||||
logger.info("Assigning new bootstrap from {}".format(rebuilded_bootstrap))
|
||||
bootstrap = "/var/www/nailgun/bootstrap"
|
||||
cmd = ("mv {0}/initramfs.img /var/initramfs.img;"
|
||||
"cp /var/initramfs.img.updated {0}/initramfs.img;"
|
||||
"chmod +r {0}/initramfs.img;"
|
||||
).format(bootstrap)
|
||||
result = remote.execute(cmd)
|
||||
assert_equal(result['exit_code'], 0,
|
||||
('Failed to assign bootstrap {}'
|
||||
).format(result))
|
||||
"chmod +r {0}/initramfs.img;").format(bootstrap)
|
||||
ssh.execute_on_remote(ip=ssh.admin_ip, cmd=cmd)
|
||||
cmd = "cobbler sync"
|
||||
environment.base_actions.execute(cmd, exit_code=0)
|
||||
except Exception as e:
|
||||
logger.error("Could not update bootstrap {e}".format(e=e))
|
||||
raise
|
||||
ssh.execute_on_remote(ip=ssh.admin_ip, cmd=cmd)
|
||||
|
||||
|
||||
def update_ostf(environment):
|
||||
def update_ostf():
|
||||
logger.info("Uploading new package from {0}".format(
|
||||
settings.UPDATE_FUEL_PATH))
|
||||
ssh = SSHManager()
|
||||
pack_path = '/var/www/nailgun/fuel-ostf/'
|
||||
full_pack_path = os.path.join(pack_path, 'fuel-ostf*.noarch.rpm')
|
||||
|
||||
with environment.d_env.get_admin_remote() as remote:
|
||||
remote.upload(settings.UPDATE_FUEL_PATH.rstrip('/'),
|
||||
pack_path)
|
||||
ssh.upload_to_remote(
|
||||
ssh.admin_ip,
|
||||
source=settings.UPDATE_FUEL_PATH.rstrip('/'), target=pack_path)
|
||||
|
||||
# Check old fuel-ostf package
|
||||
cmd = "rpm -q fuel-ostf"
|
||||
|
||||
old_package = environment.base_actions.execute(cmd, exit_code=0)
|
||||
old_package = ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)['stdout_str']
|
||||
logger.info(
|
||||
'Current package version of '
|
||||
'fuel-ostf: {0}'.format(old_package))
|
||||
|
||||
cmd = "rpm -qp {0}".format(full_pack_path)
|
||||
new_package = environment.base_actions.execute(cmd)
|
||||
new_package = ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)['stdout_str']
|
||||
logger.info('Package from review {0}'.format(new_package))
|
||||
|
||||
if old_package == new_package:
|
||||
@ -260,50 +223,53 @@ def update_ostf(environment):
|
||||
return
|
||||
|
||||
cmd = "service ostf stop"
|
||||
environment.base_actions.execute(cmd)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
cmd = "service ostf status"
|
||||
helpers.wait(lambda: "dead" in environment.base_actions.execute(cmd),
|
||||
timeout=60)
|
||||
helpers.wait(lambda: "dead" in ssh.execute_on_remote(
|
||||
ssh.admin_ip, cmd=cmd)['stdout_str'], timeout=60)
|
||||
logger.info("OSTF status: inactive")
|
||||
cmd = "rpm -e fuel-ostf"
|
||||
environment.base_actions.execute(cmd, exit_code=0)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
cmd = "rpm -Uvh --oldpackage {0}".format(full_pack_path)
|
||||
environment.base_actions.execute(cmd, exit_code=0)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
cmd = "rpm -q fuel-ostf"
|
||||
installed_package = environment.base_actions.execute(cmd)
|
||||
installed_package = ssh.execute_on_remote(
|
||||
ssh.admin_ip, cmd=cmd)['stdout_str']
|
||||
|
||||
assert_equal(
|
||||
installed_package, new_package,
|
||||
"The new package {0} was not installed. Actual {1}".format(
|
||||
new_package, installed_package))
|
||||
cmd = "service ostf start"
|
||||
environment.base_actions.execute(cmd)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
cmd = "service ostf status"
|
||||
helpers.wait(
|
||||
lambda: "running" in
|
||||
environment.base_actions.execute(cmd, exit_code=0),
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)['stdout_str'],
|
||||
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(cmd),
|
||||
lambda: "401" in ssh.execute_on_remote(
|
||||
ssh.admin_ip, cmd=cmd)['stdout_str'],
|
||||
timeout=60)
|
||||
logger.info("OSTF status: RUNNING")
|
||||
|
||||
|
||||
def get_oswl_services_names(remote):
|
||||
def get_oswl_services_names():
|
||||
cmd = "systemctl list-units| grep oswl_ | awk '{print $1}'"
|
||||
result = remote.base_actions.execute(cmd, exit_code=0)
|
||||
logger.info('list of statistic services inside nailgun {0}'.format(
|
||||
result = SSHManager().execute_on_remote(
|
||||
SSHManager().admin_ip, cmd)['stdout_str'].strip()
|
||||
logger.info('list of statistic services {0}'.format(
|
||||
result.split('\n')))
|
||||
return result.split('\n')
|
||||
|
||||
|
||||
def replace_fuel_nailgun_rpm(environment):
|
||||
def replace_fuel_nailgun_rpm():
|
||||
"""
|
||||
Replace fuel_nailgun*.rpm from review
|
||||
environment - Environment Model object - self.env
|
||||
"""
|
||||
logger.info("Patching fuel-nailgun")
|
||||
ssh = SSHManager()
|
||||
if not settings.UPDATE_FUEL:
|
||||
raise exceptions.FuelQAVariableNotSet('UPDATE_FUEL', 'True')
|
||||
pack_path = '/var/www/nailgun/fuel-nailgun/'
|
||||
@ -311,20 +277,22 @@ def replace_fuel_nailgun_rpm(environment):
|
||||
full_pack_path = os.path.join(pack_path,
|
||||
'fuel-nailgun*.noarch.rpm')
|
||||
logger.info('Package path {0}'.format(full_pack_path))
|
||||
with environment.d_env.get_admin_remote() as remote:
|
||||
remote.upload(settings.UPDATE_FUEL_PATH.rstrip('/'),
|
||||
pack_path)
|
||||
ssh.upload_to_remote(
|
||||
ip=ssh.admin_ip,
|
||||
source=settings.UPDATE_FUEL_PATH.rstrip('/'), target=pack_path)
|
||||
|
||||
# Check old fuel-nailgun package
|
||||
cmd = "rpm -q fuel-nailgun"
|
||||
|
||||
old_package = environment.base_actions.execute(cmd, exit_code=0)
|
||||
old_package = ssh.execute_on_remote(
|
||||
ip=ssh.admin_ip, cmd=cmd)['stdout_str']
|
||||
logger.info(
|
||||
'Current package version of '
|
||||
'fuel-nailgun: {0}'.format(old_package))
|
||||
|
||||
cmd = "rpm -qp {0}".format(full_pack_path)
|
||||
new_package = environment.base_actions.execute(cmd)
|
||||
new_package = ssh.execute_on_remote(
|
||||
ip=ssh.admin_ip, cmd=cmd)['stdout_str']
|
||||
logger.info("Updating package {0} with {1}".format(
|
||||
old_package, new_package))
|
||||
|
||||
@ -335,53 +303,50 @@ def replace_fuel_nailgun_rpm(environment):
|
||||
|
||||
# stop services
|
||||
service_list = ['assassind', 'receiverd', 'nailgun', 'statsenderd']
|
||||
[environment.base_actions.execute(
|
||||
'systemctl stop {0}'.format(service),
|
||||
exit_code=0) for service in service_list]
|
||||
|
||||
[ssh.execute_on_remote(
|
||||
ip=ssh.admin_ip,
|
||||
cmd='systemctl stop {0}'.format(service)) for service in service_list]
|
||||
logger.info('statistic services {0}'.format(get_oswl_services_names()))
|
||||
# stop statistic services
|
||||
[environment.base_actions.execute(
|
||||
'systemctl stop {0}'.format(service),
|
||||
exit_code=0) for service in
|
||||
get_oswl_services_names(environment)]
|
||||
[ssh.execute_on_remote(
|
||||
ip=ssh.admin_ip,
|
||||
cmd='systemctl stop {0}'.format(service))
|
||||
for service in get_oswl_services_names()]
|
||||
|
||||
# Drop nailgun db manage.py dropdb
|
||||
cmd = 'manage.py dropdb'
|
||||
environment.base_actions.execute(cmd, exit_code=0)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd)
|
||||
|
||||
# Delete package
|
||||
logger.info("Delete package {0}".format(old_package))
|
||||
cmd = "rpm -e fuel-nailgun"
|
||||
environment.base_actions.execute(cmd, exit_code=0)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd)
|
||||
|
||||
logger.info("Install package {0}".format(new_package))
|
||||
|
||||
cmd = "rpm -Uvh --oldpackage {0}".format(full_pack_path)
|
||||
|
||||
environment.base_actions.execute(cmd, exit_code=0)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd)
|
||||
|
||||
cmd = "rpm -q fuel-nailgun"
|
||||
installed_package = environment.base_actions.execute(cmd, exit_code=0)
|
||||
installed_package = ssh.execute_on_remote(ssh.admin_ip, cmd)['stdout_str']
|
||||
|
||||
assert_equal(installed_package, new_package,
|
||||
"The new package {0} was not installed".format(new_package))
|
||||
|
||||
cmd = ('puppet apply --debug '
|
||||
'/etc/puppet/modules/fuel/examples/nailgun.pp')
|
||||
environment.base_actions.execute(cmd, 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))
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd)
|
||||
cmd_sync = 'fuel release --sync-deployment-tasks --dir /etc/puppet/'
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd_sync)
|
||||
|
||||
|
||||
def update_rpm(env, path, rpm_cmd='/bin/rpm -Uvh --force'):
|
||||
def update_rpm(path, rpm_cmd='/bin/rpm -Uvh --force'):
|
||||
cmd = '{rpm_cmd} {rpm_path}'\
|
||||
.format(rpm_cmd=rpm_cmd, rpm_path=path)
|
||||
logger.info("Updating rpm '{0}'".format(path))
|
||||
try:
|
||||
env.base_actions.execute(cmd, exit_code=0)
|
||||
SSHManager().execute(SSHManager().admin_ip, cmd)
|
||||
logger.info("Rpm '{0}' has been updated successfully "
|
||||
.format(path))
|
||||
except Exception as ex:
|
||||
@ -390,15 +355,17 @@ def update_rpm(env, path, rpm_cmd='/bin/rpm -Uvh --force'):
|
||||
raise
|
||||
|
||||
|
||||
def restart_service(env, service_name, timeout=30):
|
||||
def restart_service(service_name, timeout=30):
|
||||
restart_cmd = 'service {} restart'.format(service_name)
|
||||
get_status_cmd = 'service {} status'.format(service_name)
|
||||
logger.info("Restarting service '{0}'".format(service_name))
|
||||
try:
|
||||
env.base_actions.execute(restart_cmd)
|
||||
SSHManager().execute_on_remote(SSHManager().admin_ip,
|
||||
restart_cmd)
|
||||
helpers.wait(
|
||||
lambda: 'running' in
|
||||
env.base_actions.execute(get_status_cmd, exit_code=0),
|
||||
SSHManager().execute_on_remote(SSHManager().admin_ip,
|
||||
get_status_cmd)['stdout_str'],
|
||||
timeout=timeout)
|
||||
logger.info("Service '{0}' has been restarted successfully "
|
||||
.format(service_name))
|
||||
@ -409,7 +376,7 @@ def restart_service(env, service_name, timeout=30):
|
||||
raise
|
||||
|
||||
|
||||
def does_new_pkg_equal_to_installed_pkg(env, installed_package,
|
||||
def does_new_pkg_equal_to_installed_pkg(installed_package,
|
||||
new_package):
|
||||
rpm_query_cmd = '/bin/rpm -q'
|
||||
current_version_cmd = '{rpm} {package}'\
|
||||
@ -420,9 +387,11 @@ def does_new_pkg_equal_to_installed_pkg(env, installed_package,
|
||||
logger.info("Comparing installed package version against "
|
||||
"the package version to be installed in the")
|
||||
|
||||
current_version = env.base_actions.execute(
|
||||
current_version_cmd, exit_code=0)
|
||||
new_version = env.base_actions.execute(urlfile_version_cmd, exit_code=0)
|
||||
current_version = SSHManager().execute_on_remote(
|
||||
ip=SSHManager().admin_ip, cmd=current_version_cmd)
|
||||
|
||||
new_version = SSHManager().execute_on_remote(
|
||||
ip=SSHManager().admin_ip, cmd=urlfile_version_cmd)
|
||||
|
||||
logger.info("Installed package version: {}".format(current_version))
|
||||
logger.info("Package version to be installed: {}".format(new_version))
|
||||
@ -430,11 +399,12 @@ def does_new_pkg_equal_to_installed_pkg(env, installed_package,
|
||||
return current_version == new_version
|
||||
|
||||
|
||||
def get_full_filename(env, wildcard_name):
|
||||
def get_full_filename(wildcard_name):
|
||||
cmd = 'ls {}'.format(wildcard_name)
|
||||
|
||||
logger.info("Getting full file name for: {}".format(wildcard_name))
|
||||
|
||||
full_pkg_name = env.base_actions.execute(cmd, exit_code=0)
|
||||
|
||||
full_pkg_name = SSHManager().execute_on_remote(
|
||||
ip=SSHManager().admin_ip,
|
||||
cmd=cmd)['stdout_str']
|
||||
return full_pkg_name
|
||||
|
@ -19,7 +19,6 @@ 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
|
||||
|
||||
@ -53,7 +52,7 @@ class GateFuelWeb(TestBasic):
|
||||
self.show_step(1)
|
||||
self.env.revert_snapshot("empty")
|
||||
self.show_step(2)
|
||||
replace_fuel_nailgun_rpm(self.env)
|
||||
replace_fuel_nailgun_rpm()
|
||||
self.show_step(3)
|
||||
release_id = self.fuel_web.get_releases_list_for_os(
|
||||
release_name=OPENSTACK_RELEASE)[0]
|
||||
@ -63,11 +62,10 @@ class GateFuelWeb(TestBasic):
|
||||
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)
|
||||
cmd = ('fuel env create --name={0} --release={1} --nst=tun '
|
||||
'--json'.format(self.__class__.__name__, release_id))
|
||||
env_result = self.ssh_manager.execute_on_remote(
|
||||
self.ssh_manager.admin_ip, cmd=cmd, jsonify=True)['stdout_json']
|
||||
cluster_id = env_result['id']
|
||||
|
||||
self.show_step(7)
|
||||
|
@ -16,9 +16,9 @@ import os
|
||||
|
||||
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.utils import run_on_remote
|
||||
from fuelweb_test.settings import OPENSTACK_RELEASE
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
@ -55,30 +55,31 @@ class GateAstute(TestBasic):
|
||||
|
||||
astute_service = 'astute'
|
||||
package_name = 'rubygem-astute'
|
||||
package_ext = '*noarch.rpm'
|
||||
target_path = '/var/www/nailgun/'
|
||||
package_ext = '*.noarch.rpm'
|
||||
target_path = '/var/www/nailgun/astute/'
|
||||
|
||||
self.show_step(1)
|
||||
self.env.revert_snapshot('ready_with_3_slaves')
|
||||
|
||||
self.show_step(2)
|
||||
with self.env.d_env.get_admin_remote() as remote:
|
||||
remote.upload(settings.UPDATE_FUEL_PATH.rstrip('/'), target_path)
|
||||
self.ssh_manager.upload_to_remote(
|
||||
self.ssh_manager.admin_ip,
|
||||
source=settings.UPDATE_FUEL_PATH.rstrip('/'),
|
||||
target=target_path)
|
||||
|
||||
self.show_step(3)
|
||||
pkg_path = os.path.join(target_path,
|
||||
'{}{}'.format(package_name, package_ext))
|
||||
full_package_name = utils.get_full_filename(
|
||||
self.env, wildcard_name=pkg_path)
|
||||
logger.debug('Package path is {0}'.format(pkg_path))
|
||||
full_package_name = utils.get_full_filename(wildcard_name=pkg_path)
|
||||
logger.debug('Package name is {0}'.format(full_package_name))
|
||||
full_package_path = os.path.join(os.path.dirname(pkg_path),
|
||||
full_package_name)
|
||||
if not utils.does_new_pkg_equal_to_installed_pkg(
|
||||
self.env,
|
||||
installed_package=package_name,
|
||||
new_package=full_package_path):
|
||||
utils.update_rpm(self.env, path=full_package_path)
|
||||
utils.restart_service(self.env,
|
||||
service_name=astute_service,
|
||||
utils.update_rpm(path=full_package_path)
|
||||
utils.restart_service(service_name=astute_service,
|
||||
timeout=10)
|
||||
|
||||
self.show_step(4)
|
||||
@ -87,20 +88,22 @@ class GateAstute(TestBasic):
|
||||
self.show_step(5)
|
||||
release_id = self.fuel_web.get_releases_list_for_os(
|
||||
release_name=OPENSTACK_RELEASE)[0]
|
||||
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)
|
||||
env_result = self.ssh_manager.execute_on_remote(
|
||||
self.ssh_manager.admin_ip,
|
||||
cmd=cmd, jsonify=True)['stdout_json']
|
||||
|
||||
self.show_step(6)
|
||||
cluster_id = env_result['id']
|
||||
logger.debug('cluster id is {0}'.format(cluster_id))
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-01': ['controller'],
|
||||
'slave-02': ['compute'],
|
||||
'slave-03': ['cinder'],
|
||||
'slave-03': ['cinder']
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -18,7 +18,6 @@ from gates_tests.helpers.utils import patch_and_assemble_ubuntu_bootstrap
|
||||
from gates_tests.helpers.utils import replace_fuel_agent_rpm
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.helpers.utils import run_on_remote
|
||||
from fuelweb_test.settings import OPENSTACK_RELEASE
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
@ -55,7 +54,7 @@ class Gate(TestBasic):
|
||||
self.env.revert_snapshot("ready")
|
||||
|
||||
self.show_step(2)
|
||||
replace_fuel_agent_rpm(self.env)
|
||||
replace_fuel_agent_rpm()
|
||||
|
||||
self.show_step(3)
|
||||
patch_and_assemble_ubuntu_bootstrap(self.env)
|
||||
@ -68,11 +67,11 @@ class Gate(TestBasic):
|
||||
release_name=OPENSTACK_RELEASE)[0]
|
||||
|
||||
self.show_step(5)
|
||||
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)
|
||||
cmd = ('fuel env create --name={0} --release={1} --nst=tun '
|
||||
'--json'.format(self.__class__.__name__, release_id))
|
||||
env_result = self.ssh_manager.execute_on_remote(
|
||||
ip=self.ssh_manager.admin_ip,
|
||||
cmd=cmd, jsonify=True)['stdout_json']
|
||||
cluster_id = env_result['id']
|
||||
|
||||
self.show_step(6)
|
||||
|
@ -117,7 +117,7 @@ class GateOstf(TestBasic):
|
||||
'gate_ostf_ceph_ha'):
|
||||
raise SkipTest()
|
||||
self.show_step(2)
|
||||
update_ostf(self.env)
|
||||
update_ostf()
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
self.show_step(3)
|
||||
all_test_suits = self.fuel_web.get_all_ostf_set_names(cluster_id)
|
||||
|
Loading…
Reference in New Issue
Block a user