ha one controller tests: make unicode
Use repr in logwrap make unicode strings ha one controller tests get_cluster_block_devices -> make unicode output (method used 1 times in single test) Change-Id: Ia72f57b6be13c66edfcb4512f99f01f11da20f13 Closes-bug: #1620330
This commit is contained in:
parent
6dfb80d019
commit
5fb4f5d0bf
@ -47,10 +47,10 @@ class TestLogWrap(unittest.TestCase):
|
|||||||
|
|
||||||
logger.assert_has_calls((
|
logger.assert_has_calls((
|
||||||
call.debug(
|
call.debug(
|
||||||
"Calling: func with args: {} {}".format(
|
"Calling: 'func' with args: {!r} {!r}".format(
|
||||||
call_args, call_kwargs)),
|
call_args, call_kwargs)),
|
||||||
call.debug(
|
call.debug(
|
||||||
"Done: func with result: {}".format(result))
|
"Done: 'func' with result: {!r}".format(result))
|
||||||
))
|
))
|
||||||
|
|
||||||
def test_negative(self, logger):
|
def test_negative(self, logger):
|
||||||
@ -66,10 +66,10 @@ class TestLogWrap(unittest.TestCase):
|
|||||||
|
|
||||||
logger.assert_has_calls((
|
logger.assert_has_calls((
|
||||||
call.debug(
|
call.debug(
|
||||||
"Calling: func with args: {} {}".format(
|
"Calling: 'func' with args: {!r} {!r}".format(
|
||||||
call_args, call_kwargs)),
|
call_args, call_kwargs)),
|
||||||
call.exception(
|
call.exception(
|
||||||
'func raised: ValueError({}, {})\n'.format(
|
"'func' raised: ValueError({}, {})\n".format(
|
||||||
call_args, call_kwargs))
|
call_args, call_kwargs))
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -24,17 +24,17 @@ def logwrap(func):
|
|||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def wrapped(*args, **kwargs):
|
def wrapped(*args, **kwargs):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Calling: {} with args: {} {}".format(
|
"Calling: {!r} with args: {!r} {!r}".format(
|
||||||
func.__name__, args, kwargs
|
func.__name__, args, kwargs
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
result = func(*args, **kwargs)
|
result = func(*args, **kwargs)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Done: {} with result: {}".format(func.__name__, result))
|
"Done: {!r} with result: {!r}".format(func.__name__, result))
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
'{func} raised: {exc!r}\n'.format(func=func.__name__, exc=e))
|
'{func!r} raised: {exc!r}\n'.format(func=func.__name__, exc=e))
|
||||||
raise
|
raise
|
||||||
return result
|
return result
|
||||||
return wrapped
|
return wrapped
|
||||||
|
@ -1069,8 +1069,7 @@ class FuelWebClient29(object):
|
|||||||
def get_cluster_block_devices(self, node_name):
|
def get_cluster_block_devices(self, node_name):
|
||||||
logger.info('Get %s node block devices (lsblk)', node_name)
|
logger.info('Get %s node block devices (lsblk)', node_name)
|
||||||
with self.get_ssh_for_node(node_name) as remote:
|
with self.get_ssh_for_node(node_name) as remote:
|
||||||
ret = remote.check_call('/bin/lsblk')
|
return remote.check_call('/bin/lsblk').stdout_str
|
||||||
return ''.join(ret['stdout'])
|
|
||||||
|
|
||||||
@logwrap
|
@logwrap
|
||||||
def get_pacemaker_status(self, controller_node_name):
|
def get_pacemaker_status(self, controller_node_name):
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -290,9 +291,11 @@ class HAOneControllerNeutron(HAOneControllerNeutronBase):
|
|||||||
self.fuel_web.run_ostf(cluster_id=cluster_id)
|
self.fuel_web.run_ostf(cluster_id=cluster_id)
|
||||||
|
|
||||||
_ip = self.fuel_web.get_nailgun_node_by_name("slave-03")['ip']
|
_ip = self.fuel_web.get_nailgun_node_by_name("slave-03")['ip']
|
||||||
result = self.ssh_manager.execute_on_remote(cmd='hiera roles',
|
result = self.ssh_manager.check_call(
|
||||||
ip=_ip)['stdout_str']
|
command='hiera roles', ip=_ip).stdout_str
|
||||||
assert_equal('[\"base-os\"]', result,
|
assert_equal(
|
||||||
|
'["base-os"]',
|
||||||
|
result,
|
||||||
message="Role mismatch. Node slave-03 is not base-os")
|
message="Role mismatch. Node slave-03 is not base-os")
|
||||||
|
|
||||||
self.env.make_snapshot("deploy_base_os_node")
|
self.env.make_snapshot("deploy_base_os_node")
|
||||||
@ -461,8 +464,7 @@ class MultiroleMultipleServices(TestBasic):
|
|||||||
"sed -i 's,http://archive.ubuntu.com/ubuntu,{0},g'" \
|
"sed -i 's,http://archive.ubuntu.com/ubuntu,{0},g'" \
|
||||||
" /usr/share/fuel-mirror/ubuntu.yaml".format(
|
" /usr/share/fuel-mirror/ubuntu.yaml".format(
|
||||||
ubuntu_url)
|
ubuntu_url)
|
||||||
self.ssh_manager.execute_on_remote(ip=admin_ip,
|
self.ssh_manager.check_call(ip=admin_ip, command=replace_cmd)
|
||||||
cmd=replace_cmd)
|
|
||||||
|
|
||||||
create_mirror_cmd = 'fuel-mirror create -P ubuntu -G mos ubuntu'
|
create_mirror_cmd = 'fuel-mirror create -P ubuntu -G mos ubuntu'
|
||||||
self.env.admin_actions.ensure_cmd(create_mirror_cmd)
|
self.env.admin_actions.ensure_cmd(create_mirror_cmd)
|
||||||
@ -486,7 +488,7 @@ class MultiroleMultipleServices(TestBasic):
|
|||||||
self.show_step(4)
|
self.show_step(4)
|
||||||
apply_mirror_cmd = 'fuel-mirror apply -P ubuntu -G mos ubuntu ' \
|
apply_mirror_cmd = 'fuel-mirror apply -P ubuntu -G mos ubuntu ' \
|
||||||
'--env {0} --replace'.format(cluster_id)
|
'--env {0} --replace'.format(cluster_id)
|
||||||
self.ssh_manager.execute_on_remote(ip=admin_ip, cmd=apply_mirror_cmd)
|
self.ssh_manager.check_call(ip=admin_ip, command=apply_mirror_cmd)
|
||||||
|
|
||||||
self.fuel_web.update_nodes(
|
self.fuel_web.update_nodes(
|
||||||
cluster_id,
|
cluster_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user