summaryrefslogtreecommitdiffstats
path: root/tests/unit/test_tempest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test_tempest.py')
-rw-r--r--tests/unit/test_tempest.py42
1 files changed, 35 insertions, 7 deletions
diff --git a/tests/unit/test_tempest.py b/tests/unit/test_tempest.py
index b03b3c0f..3e229dc9 100644
--- a/tests/unit/test_tempest.py
+++ b/tests/unit/test_tempest.py
@@ -34,7 +34,8 @@ from deploy.tempest import (
update_network,
get_hosts,
get_cluster,
- add_hosts_interface,
+ update_hosts_interface,
+ get_hugepages,
add_host_role,
enable_cinder_backend,
enable_opendaylight
@@ -173,7 +174,9 @@ def test_get_cluster():
@pytest.mark.parametrize('isbare', [
(False), (True)])
-def test_add_hosts_interface(isbare, tmpdir):
+@mock.patch('deploy.tempest.get_hugepages')
+def test_update_hosts_interface(mock_get_hugepages, isbare, tmpdir):
+ mock_get_hugepages.return_value = 80
res_old_val = deploy.tempest.iso_path
deploy.tempest.iso_path = os.path.join(tmpdir.dirname, tmpdir.basename) + '/'
iso_file_path = os.path.join(deploy.tempest.iso_path, 'test_os.iso')
@@ -206,9 +209,9 @@ def test_add_hosts_interface(isbare, tmpdir):
{'ip': '', 'name': 'physnet1'}],
'ens9': [{'ip': '', 'name': 'HEARTBEAT'}]}
vip = '10.20.11.11'
- add_hosts_interface(1, hosts_info, mac_address_map,
- host_interface_map,
- vip, isbare, client)
+ update_hosts_interface(1, hosts_info, mac_address_map,
+ host_interface_map,
+ vip, isbare, client, True)
deploy.tempest.iso_path = res_old_val
if isbare:
assert client.hosts.get(host_id1).metadata == {
@@ -217,6 +220,8 @@ def test_add_hosts_interface(isbare, tmpdir):
'ipmi_user': 'zteroot', 'ipmi_passwd': 'superuser',
'interfaces': [{'name': 'ens8', 'mac': '11:11:11:11:11:11',
'assigned_networks': [{'ip': '', 'name': 'EXTERNAL'}]}],
+ 'hugepagesize': '1G',
+ 'hugepages': '80',
}
assert client.hosts.get(host_id2).metadata == {
'id': host_id2, 'name': 'controller02', 'cluster_id': cluster_id,
@@ -227,7 +232,10 @@ def test_add_hosts_interface(isbare, tmpdir):
{'ip': '', 'name': 'MANAGEMENT'},
{'ip': '', 'name': 'PUBLICAPI'},
{'ip': '', 'name': 'STORAGE'},
- {'ip': '', 'name': 'physnet1'}]}],
+ {'ip': '', 'name': 'physnet1'}],
+ 'vswitch_type': 'dvs'}],
+ 'hugepagesize': '1G',
+ 'hugepages': '80',
}
assert client.hosts.get(host_id3).metadata == {
'id': host_id3, 'name': 'computer01', 'cluster_id': cluster_id,
@@ -235,6 +243,8 @@ def test_add_hosts_interface(isbare, tmpdir):
'ipmi_user': 'zteroot', 'ipmi_passwd': 'superuser',
'interfaces': [{'name': 'ens9', 'mac': '33:33:33:33:33:33',
'assigned_networks': [{'ip': '', 'name': 'HEARTBEAT'}]}],
+ 'hugepagesize': '1G',
+ 'hugepages': '80',
}
else:
assert client.hosts.get(host_id1).metadata == {
@@ -242,6 +252,8 @@ def test_add_hosts_interface(isbare, tmpdir):
'cluster': cluster_id, 'os_version': iso_file_path,
'interfaces': [{'name': 'ens8', 'mac': '11:11:11:11:11:11',
'assigned_networks': [{'ip': '', 'name': 'EXTERNAL'}]}],
+ 'hugepagesize': '1G',
+ 'hugepages': '80',
}
assert client.hosts.get(host_id2).metadata == {
'id': host_id2, 'name': 'controller02', 'cluster_id': cluster_id,
@@ -251,17 +263,33 @@ def test_add_hosts_interface(isbare, tmpdir):
{'ip': '', 'name': 'MANAGEMENT'},
{'ip': '', 'name': 'PUBLICAPI'},
{'ip': '', 'name': 'STORAGE'},
- {'ip': '', 'name': 'physnet1'}]}],
+ {'ip': '', 'name': 'physnet1'}],
+ 'vswitch_type': 'dvs'}],
+ 'hugepagesize': '1G',
+ 'hugepages': '80',
}
assert client.hosts.get(host_id3).metadata == {
'id': host_id3, 'name': 'computer01', 'cluster_id': cluster_id,
'cluster': cluster_id, 'os_version': iso_file_path,
'interfaces': [{'name': 'ens9', 'mac': '33:33:33:33:33:33',
'assigned_networks': [{'ip': '', 'name': 'HEARTBEAT'}]}],
+ 'hugepagesize': '1G',
+ 'hugepages': '80',
}
tmpdir.remove()
+@pytest.mark.parametrize('host, exp', [
+ ({'memory': {'total': ' 65938504 kB'}}, 38),
+ ({'memory': {'total': ' 131644068 kB'}}, 76),
+ ({'memory': {'total': ' 100 gB'}}, 60),
+ ({'memory': {'total': ' 102400 mB'}}, 60),
+ ({'memory': {'total': ' 107374182400 B'}}, 60),
+ ({'memory': {'total': ' 107374182400'}}, 60)])
+def test_get_hugepages(host, exp):
+ assert get_hugepages(host) == exp
+
+
@pytest.mark.parametrize('dha_host_name, cluster_id, host_id, vip, exp', [
('controller01', 1, 0x1234, '10.20.11.11', {'nodes': [0x1234], 'cluster_id': 1, 'vip': '10.20.11.11'}),
('computer01', 1, 0x2345, '10.20.11.11', {'nodes': [0x2345], 'cluster_id': 1}),