summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/data/openrc_conf/admin-openrc.sh8
-rw-r--r--tests/data/openrc_conf/globals_odl.yml2
-rw-r--r--tests/unit/post/test_post_execute.py9
-rw-r--r--tests/unit/test_daisy_server.py9
-rw-r--r--tests/unit/test_environment.py9
-rw-r--r--tests/unit/test_placeholder.py10
-rw-r--r--tests/unit/test_tempest.py42
7 files changed, 79 insertions, 10 deletions
diff --git a/tests/data/openrc_conf/admin-openrc.sh b/tests/data/openrc_conf/admin-openrc.sh
index 3db0bcf3..2440fda8 100644
--- a/tests/data/openrc_conf/admin-openrc.sh
+++ b/tests/data/openrc_conf/admin-openrc.sh
@@ -1,3 +1,11 @@
+##############################################################################
+# Copyright (c) 2018 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
diff --git a/tests/data/openrc_conf/globals_odl.yml b/tests/data/openrc_conf/globals_odl.yml
index 588dd927..2598ccbb 100644
--- a/tests/data/openrc_conf/globals_odl.yml
+++ b/tests/data/openrc_conf/globals_odl.yml
@@ -11,3 +11,5 @@ neutron_external_interface: ens8
openstack_release: 4.0.2
storage_interface: ens3
tunnel_interface: ens3
+opendaylight_haproxy_restconf_port: '8087'
+opendaylight_haproxy_restconf_port_backup: '8181'
diff --git a/tests/unit/post/test_post_execute.py b/tests/unit/post/test_post_execute.py
index 55e345a2..0ca00941 100644
--- a/tests/unit/post/test_post_execute.py
+++ b/tests/unit/post/test_post_execute.py
@@ -169,9 +169,12 @@ def test__config_kolla_admin_openrc(globals_file_name, openrc_conf_file_dir, tmp
elif globals_file_name == 'globals_odl.yml':
diff = DeepDiff(src_openrc_lines, dst_openrc_lines, ignore_order=True)
assert len(diff) == 1 and diff.get('iterable_item_added') is not None
- assert len(diff['iterable_item_added']) == 1
- for val in diff['iterable_item_added'].values():
- assert 'export SDN_CONTROLLER_IP' in val
+ assert len(diff['iterable_item_added']) == 3
+ diffvals = ','.join(diff['iterable_item_added'].values())
+ assert 'export SDN_CONTROLLER_IP' in diffvals
+ assert 'export SDN_CONTROLLER_WEBPORT=' in diffvals
+ assert 'export SDN_CONTROLLER_RESTCONFPORT=' in diffvals
+
tmpdir.remove()
diff --git a/tests/unit/test_daisy_server.py b/tests/unit/test_daisy_server.py
index ea9c495c..007279a7 100644
--- a/tests/unit/test_daisy_server.py
+++ b/tests/unit/test_daisy_server.py
@@ -1,3 +1,12 @@
+##############################################################################
+# Copyright (c) 2018 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
import os
import pytest
import mock
diff --git a/tests/unit/test_environment.py b/tests/unit/test_environment.py
index f7cf5985..a0b39ffd 100644
--- a/tests/unit/test_environment.py
+++ b/tests/unit/test_environment.py
@@ -1,3 +1,12 @@
+##############################################################################
+# Copyright (c) 2018 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
import os
import copy
import mock
diff --git a/tests/unit/test_placeholder.py b/tests/unit/test_placeholder.py
index 457e464c..7fa104ff 100644
--- a/tests/unit/test_placeholder.py
+++ b/tests/unit/test_placeholder.py
@@ -1,2 +1,12 @@
+##############################################################################
+# Copyright (c) 2018 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
def test_holder():
assert True
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}),