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.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/unit/test_tempest.py b/tests/unit/test_tempest.py
index 9a70aec5..3e229dc9 100644
--- a/tests/unit/test_tempest.py
+++ b/tests/unit/test_tempest.py
@@ -35,6 +35,7 @@ from deploy.tempest import (
get_hosts,
get_cluster,
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_update_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')
@@ -218,7 +221,7 @@ def test_update_hosts_interface(isbare, tmpdir):
'interfaces': [{'name': 'ens8', 'mac': '11:11:11:11:11:11',
'assigned_networks': [{'ip': '', 'name': 'EXTERNAL'}]}],
'hugepagesize': '1G',
- 'hugepages': '20',
+ 'hugepages': '80',
}
assert client.hosts.get(host_id2).metadata == {
'id': host_id2, 'name': 'controller02', 'cluster_id': cluster_id,
@@ -232,7 +235,7 @@ def test_update_hosts_interface(isbare, tmpdir):
{'ip': '', 'name': 'physnet1'}],
'vswitch_type': 'dvs'}],
'hugepagesize': '1G',
- 'hugepages': '20',
+ 'hugepages': '80',
}
assert client.hosts.get(host_id3).metadata == {
'id': host_id3, 'name': 'computer01', 'cluster_id': cluster_id,
@@ -241,7 +244,7 @@ def test_update_hosts_interface(isbare, tmpdir):
'interfaces': [{'name': 'ens9', 'mac': '33:33:33:33:33:33',
'assigned_networks': [{'ip': '', 'name': 'HEARTBEAT'}]}],
'hugepagesize': '1G',
- 'hugepages': '20',
+ 'hugepages': '80',
}
else:
assert client.hosts.get(host_id1).metadata == {
@@ -250,7 +253,7 @@ def test_update_hosts_interface(isbare, tmpdir):
'interfaces': [{'name': 'ens8', 'mac': '11:11:11:11:11:11',
'assigned_networks': [{'ip': '', 'name': 'EXTERNAL'}]}],
'hugepagesize': '1G',
- 'hugepages': '20',
+ 'hugepages': '80',
}
assert client.hosts.get(host_id2).metadata == {
'id': host_id2, 'name': 'controller02', 'cluster_id': cluster_id,
@@ -263,7 +266,7 @@ def test_update_hosts_interface(isbare, tmpdir):
{'ip': '', 'name': 'physnet1'}],
'vswitch_type': 'dvs'}],
'hugepagesize': '1G',
- 'hugepages': '20',
+ 'hugepages': '80',
}
assert client.hosts.get(host_id3).metadata == {
'id': host_id3, 'name': 'computer01', 'cluster_id': cluster_id,
@@ -271,11 +274,22 @@ def test_update_hosts_interface(isbare, tmpdir):
'interfaces': [{'name': 'ens9', 'mac': '33:33:33:33:33:33',
'assigned_networks': [{'ip': '', 'name': 'HEARTBEAT'}]}],
'hugepagesize': '1G',
- 'hugepages': '20',
+ '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}),