Fix assertion text and disk size info

1. Made human readable assertion text.
2. Disk size is rounded to point 3 digits.

Change-Id: I2e7d9c313cfe94839a77700df84a606de626b530
Closes-bug: #1561687
This commit is contained in:
Alexey Stepanov 2016-03-25 12:00:45 +03:00
parent 6c5f69c844
commit 066eb35d7e

View File

@ -676,7 +676,10 @@ class NodeDiskSizes(TestBasic):
for disk in node['meta']['disks']:
assert_equal(disk['size'], disk_size, 'Disk size')
hdd_size = "{} TB HDD".format((disk_size * 3 / (10 ** 9)) / 1000)
# pylint: disable=:round-builtin
hdd_size = "{} TB HDD".format(
round(((disk_size * 3 / (10 ** 9)) / 1000), 3))
# pylint: enable=:round-builtin
notifications = self.fuel_web.client.get_notifications()
for node in nailgun_nodes:
# assert /api/notifications
@ -685,13 +688,25 @@ class NodeDiskSizes(TestBasic):
current_node = notification['node_id'] == node['id']
if current_node and discover and \
"discovered" in notification['message']:
assert_true(hdd_size in notification['message'])
assert_true(
hdd_size in notification['message'],
'"{size}" not found in notification message '
'"{note}" for node {node} (hostname {host})!'.format(
size=hdd_size,
note=notification['message'],
node=node['name'],
host=node['hostname']
)
)
# assert disks
disks = self.fuel_web.client.get_node_disks(node['id'])
for disk in disks:
assert_equal(disk['size'],
NODE_VOLUME_SIZE * 1024 - 500, 'Disk size')
assert_equal(
disk['size'], NODE_VOLUME_SIZE * 1024 - 500,
'Disk size {0} is not equals expected {1}'.format(
disk['size'], NODE_VOLUME_SIZE * 1024 - 500
))
@test(depends_on=[NodeMultipleInterfaces.deploy_node_multiple_interfaces],
groups=["check_nodes_disks"])