aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/kolla_container_tests/test_docker_worker.py73
-rw-r--r--tests/kolla_container_tests/test_podman_worker.py75
-rw-r--r--tests/run-openbao.yml9
-rw-r--r--tests/run.yml27
-rw-r--r--tests/templates/globals-default.j29
-rw-r--r--tests/test_kolla_toolbox.py47
-rw-r--r--tests/testinfra/test_horizon.py18
7 files changed, 189 insertions, 69 deletions
diff --git a/tests/kolla_container_tests/test_docker_worker.py b/tests/kolla_container_tests/test_docker_worker.py
index c79022462..26fe020f2 100644
--- a/tests/kolla_container_tests/test_docker_worker.py
+++ b/tests/kolla_container_tests/test_docker_worker.py
@@ -42,7 +42,7 @@ FAKE_DATA = {
'container_engine': 'docker',
'api_version': None,
'auth_username': None,
- 'auth_password': None,
+ 'auth_password': None, # nosec B105
'auth_registry': None,
'restart_policy': None,
'auth_email': None,
@@ -125,7 +125,7 @@ FAKE_DATA = {
FAKE_DATA_COMMON_OPTS = {
'auth_username': 'kevko',
- 'auth_password': 'SECRET',
+ 'auth_password': 'SECRET', # nosec B105
'auth_registry': 'Quay.io/kolla',
'restart_policy': 'unless-stopped',
'auth_email': 'kevko@kevko.org',
@@ -144,7 +144,7 @@ def get_DockerWorker(mod_param, docker_api_version='1.40'):
common_options_defaults = {
'auth_email': None,
- 'auth_password': None,
+ 'auth_password': None, # nosec B105
'auth_registry': None,
'auth_username': None,
'environment': None,
@@ -405,10 +405,13 @@ class TestContainer(base.BaseTestCase):
self.assertEqual(self.dw.create_volume.call_count, 2)
def test_start_container_without_pull(self):
- self.fake_data['params'].update({'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'})
+ params = {
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(params)
self.dw = get_DockerWorker(self.fake_data['params'])
self.dw.dc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -425,11 +428,14 @@ class TestContainer(base.BaseTestCase):
self.dw.create_container.assert_called_once_with()
def test_start_container_with_duplicate_name(self):
- self.fake_data['params'].update({'name': 'my_container',
- 'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'})
+ params = {
+ 'name': 'my_container',
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(params)
self.dw = get_DockerWorker(self.fake_data['params'])
self.dw.dc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -453,11 +459,14 @@ class TestContainer(base.BaseTestCase):
self.dw.create_container.assert_called_once_with()
def test_start_container(self):
- self.fake_data['params'].update({'name': 'my_container',
- 'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'})
+ params = {
+ 'name': 'my_container',
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(params)
self.dw = get_DockerWorker(self.fake_data['params'])
self.dw.dc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -497,12 +506,15 @@ class TestContainer(base.BaseTestCase):
self.assertEqual(expected, self.dw.result)
def test_start_container_no_systemd(self):
- self.fake_data['params'].update({'name': 'my_container',
- 'restart_policy': 'oneshot',
- 'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'})
+ params = {
+ 'name': 'my_container',
+ 'restart_policy': 'oneshot',
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(params)
self.dw = get_DockerWorker(self.fake_data['params'])
self.dw.dc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -520,11 +532,14 @@ class TestContainer(base.BaseTestCase):
self.dw.systemd.start.assert_not_called()
def test_start_container_systemd_start_fail(self):
- self.fake_data['params'].update({'name': 'my_container',
- 'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'})
+ params = {
+ 'name': 'my_container',
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(params)
self.dw = get_DockerWorker(self.fake_data['params'])
self.dw.dc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -944,7 +959,7 @@ class TestImage(base.BaseTestCase):
self.dw = get_DockerWorker(
{'image': 'myregistrydomain.com:5000/ubuntu:16.04',
'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
+ 'auth_password': 'fake_psw', # nosec B105
'auth_registry': 'myrepo/myapp',
'auth_email': 'fake_mail@foogle.com'
})
diff --git a/tests/kolla_container_tests/test_podman_worker.py b/tests/kolla_container_tests/test_podman_worker.py
index b3bfcdce2..55ab5c165 100644
--- a/tests/kolla_container_tests/test_podman_worker.py
+++ b/tests/kolla_container_tests/test_podman_worker.py
@@ -299,10 +299,13 @@ class TestContainer(base.BaseTestCase):
self.assertEqual(self.pw.create_volume.call_count, 2)
def test_start_container_without_pull(self):
- self.fake_data['params'].update({'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'})
+ auth_params = {
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(auth_params)
self.pw = get_PodmanWorker(self.fake_data['params'].copy())
self.pw.pc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -322,11 +325,14 @@ class TestContainer(base.BaseTestCase):
self.pw.create_container.assert_called_once_with()
def test_start_container_with_duplicate_name(self):
- self.fake_data['params'].update({'name': 'my_container',
- 'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'})
+ auth_params = {
+ 'name': 'my_container',
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(auth_params)
self.pw = get_PodmanWorker(self.fake_data['params'])
self.pw.pc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -348,11 +354,13 @@ class TestContainer(base.BaseTestCase):
self.pw.create_container.assert_called_once_with()
def test_start_container(self):
- self.fake_data['params'].update({'name': 'my_container',
- 'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'})
+ auth_params = {
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(auth_params)
self.pw = get_PodmanWorker(self.fake_data['params'])
self.pw.pc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -403,12 +411,15 @@ class TestContainer(base.BaseTestCase):
self.assertEqual(expected, self.pw.result)
def test_start_container_no_systemd(self):
- self.fake_data['params'].update({'name': 'my_container',
- 'restart_policy': 'oneshot',
- 'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'})
+ auth_params = {
+ 'name': 'my_container',
+ 'restart_policy': 'oneshot',
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(auth_params)
self.pw = get_PodmanWorker(self.fake_data['params'])
self.pw.pc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -426,12 +437,14 @@ class TestContainer(base.BaseTestCase):
self.pw.systemd.start.assert_not_called()
def test_start_container_systemd_start_fail(self):
- self.fake_data['params'].update({'name': 'my_container',
- 'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
- 'auth_registry': 'myrepo/myapp',
- 'auth_email': 'fake_mail@foogle.com'}
- )
+ params = {
+ 'name': 'my_container',
+ 'auth_username': 'fake_user',
+ 'auth_password': 'fake_psw', # nosec B105
+ 'auth_registry': 'myrepo/myapp',
+ 'auth_email': 'fake_mail@foogle.com'
+ }
+ self.fake_data['params'].update(params)
self.pw = get_PodmanWorker(self.fake_data['params'])
self.pw.pc.images = mock.MagicMock(
return_value=self.fake_data['images'])
@@ -818,7 +831,7 @@ class TestImage(base.BaseTestCase):
self.pw = get_PodmanWorker(
{'image': 'myregistrydomain.com:5000/ubuntu:16.04',
'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
+ 'auth_password': 'fake_psw', # nosec B105
'auth_registry': 'myrepo/myapp',
'auth_email': 'fake_mail@foogle.com'
})
@@ -832,7 +845,8 @@ class TestImage(base.BaseTestCase):
tag='16.04',
tls_verify=False,
stream=False,
- auth_config={'username': 'fake_user', 'password': 'fake_psw'}
+ auth_config={'username': 'fake_user',
+ 'password': 'fake_psw'} # nosec B105
)
self.assertTrue(self.pw.changed)
@@ -840,7 +854,7 @@ class TestImage(base.BaseTestCase):
self.pw = get_PodmanWorker(
{'image': 'myregistrydomain.com:5000/ubuntu:16.04',
'auth_username': 'fake_user',
- 'auth_password': 'fake_psw',
+ 'auth_password': 'fake_psw', # nosec B105
'auth_registry': 'myrepo/myapp',
'auth_email': 'fake_mail@foogle.com'
})
@@ -854,7 +868,8 @@ class TestImage(base.BaseTestCase):
tag='16.04',
tls_verify=False,
stream=False,
- auth_config={'username': 'fake_user', 'password': 'fake_psw'}
+ auth_config={'username': 'fake_user',
+ 'password': 'fake_psw'} # nosec B105
)
self.assertFalse(self.pw.changed)
diff --git a/tests/run-openbao.yml b/tests/run-openbao.yml
index f8d2fe259..9b13fc34c 100644
--- a/tests/run-openbao.yml
+++ b/tests/run-openbao.yml
@@ -36,6 +36,15 @@
cmd: "{{ 'python3.12' if ansible_facts.os_family == 'RedHat' else 'python3' }} -m venv {{ kolla_ansible_venv_path }}"
creates: "{{ kolla_ansible_venv_path }}"
+ # TODO(bbezak): Drop this workaround once kolla-ansible supports bcrypt 5.
+ - name: Pin bcrypt to <5 in upper-constraints in CI
+ lineinfile:
+ path: "{{ upper_constraints_file }}"
+ regexp: '^bcrypt==='
+ line: 'bcrypt===4.3.0'
+ state: present
+ when: zuul.branch == 'master'
+
- name: Ensure the latest tested pip
pip:
name: "pip==23.*"
diff --git a/tests/run.yml b/tests/run.yml
index a3c9ab46f..57a3de61b 100644
--- a/tests/run.yml
+++ b/tests/run.yml
@@ -17,6 +17,7 @@
ansible_collection_kolla_src_dir: "{{ ansible_env.PWD }}/src/{{ zuul.project.canonical_hostname }}/openstack/ansible-collection-kolla"
kolla_ansible_src_dir: "{{ ansible_env.PWD }}/src/{{ zuul.project.canonical_hostname }}/openstack/kolla-ansible"
kolla_ansible_local_src_dir: "{{ zuul.executor.work_root }}/src/{{ zuul.project.canonical_hostname }}/openstack/kolla-ansible"
+ tempest_src_dir: "{{ ansible_env.PWD }}/src/{{ zuul.project.canonical_hostname }}/openstack/tempest"
infra_dockerhub_mirror: "http://{{ zuul_site_mirror_fqdn }}:8082/"
need_build_image: "{{ kolla_build_images | default(false) }}"
build_image_tag: "change_{{ zuul.change | default('none') }}"
@@ -253,6 +254,15 @@
state: directory
become: true
+ # TODO(bbezak): Drop this workaround once kolla-ansible supports bcrypt 5.
+ - name: Pin bcrypt to <5 in upper-constraints in CI
+ lineinfile:
+ path: "{{ upper_constraints_file }}"
+ regexp: '^bcrypt==='
+ line: 'bcrypt===4.3.0'
+ state: present
+ when: zuul.branch == 'master'
+
- name: Create Kolla Ansible venv
command:
cmd: "{{ 'python3.12' if ansible_facts.os_family == 'RedHat' else 'python3' }} -m venv {{ kolla_ansible_venv_path }}"
@@ -416,6 +426,10 @@
- import_role:
name: kolla-ansible-tempest
+ vars:
+ kolla_ansible_tempest_packages:
+ - python-tempestconf
+ - "{{ tempest_src_dir if (zuul.branch == 'master' and not is_upgrade) else 'tempest' }}"
when: openstack_core_tested
- name: Run test-zun.sh script
@@ -610,6 +624,15 @@
git log --pretty=oneline -1
chdir: "{{ ansible_env.HOME }}/src/opendev.org/openstack/requirements/"
+ # TODO(bbezak): Drop this workaround once kolla-ansible supports bcrypt 5.
+ - name: Pin bcrypt to <5 in upper-constraints in CI
+ lineinfile:
+ path: "{{ upper_constraints_file }}"
+ regexp: '^bcrypt==='
+ line: 'bcrypt===4.3.0'
+ state: present
+ when: zuul.branch == 'master'
+
- name: Generate configuration files
template:
src: "{{ kolla_ansible_local_src_dir }}/{{ item.src }}"
@@ -655,7 +678,6 @@
name:
- "{{ kolla_ansible_src_dir }}"
- "ansible-core{{ ansible_core_version_constraint }}"
- - "ara<1.0.0"
virtualenv: "{{ kolla_ansible_venv_path }}"
when: is_slurp
@@ -707,6 +729,9 @@
name: kolla-ansible-tempest
vars:
post_upgrade: true
+ kolla_ansible_tempest_packages:
+ - python-tempestconf
+ - "{{ tempest_src_dir if (zuul.branch == 'master' and not is_upgrade) else 'tempest' }}"
when: openstack_core_tested
- name: Run test-prometheus-opensearch.sh script (post-upgrade)
diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2
index 01444d0b9..2c85ed92c 100644
--- a/tests/templates/globals-default.j2
+++ b/tests/templates/globals-default.j2
@@ -66,8 +66,8 @@ kolla_internal_vip_address: "{{ kolla_internal_vip_address }}"
neutron_external_interface: "{{ neutron_external_interface_name }}"
openstack_logging_debug: "True"
nova_libvirt_logging_debug: "False"
-openstack_service_workers: "1"
-openstack_service_rpc_workers: "1"
+openstack_service_workers: "2"
+openstack_service_rpc_workers: "2"
{% endif %}
{% if need_build_image and not is_previous_release %}
@@ -196,6 +196,7 @@ libvirt_tls: "yes"
neutron_plugin_agent: "ovn"
neutron_ovn_distributed_fip: "yes"
neutron_enable_ovn_agent: "yes"
+ovn_sb_db_relay_count: "3"
enable_octavia: "yes"
octavia_provider_drivers: "ovn:OVN provider"
octavia_provider_agents: "ovn"
@@ -287,3 +288,7 @@ enable_keystone_federation: true
mariadb_monitor_read_only_interval: "30000"
mariadb_monitor_galera_healthcheck_timeout: "30000"
+
+{% if scenario == "cloudkitty" %}
+enable_cloudkitty: true
+{% endif %}
diff --git a/tests/test_kolla_toolbox.py b/tests/test_kolla_toolbox.py
index 9dca821cc..e170964db 100644
--- a/tests/test_kolla_toolbox.py
+++ b/tests/test_kolla_toolbox.py
@@ -263,6 +263,53 @@ class TestKollaToolboxMethods(TestKollaToolboxModule):
self.assertIn('Ansible JSON output has unexpected format',
error.result['msg'])
+ def test_process_container_output_deprecation(self):
+ container_output_deprecation = "[DEPRECATION WARNING] Some deprecation"
+ container_output_json = {
+ 'custom_stats': {},
+ 'global_custom_stats': {},
+ 'plays': [
+ {
+ 'tasks': [
+ {
+ 'hosts': {
+ 'localhost': {
+ '_ansible_no_log': False,
+ 'action': 'ping',
+ 'changed': False,
+ 'invocation': {
+ 'module_args': {
+ 'data': 'pong'
+ }
+ },
+ 'ping': 'pong'
+ }
+ },
+ }
+ ]
+ }
+ ],
+ }
+ container_encoded_json = json.dumps(container_output_json)
+ container_output = (str(container_output_deprecation) +
+ str(container_encoded_json)).encode('utf-8')
+
+ expected_output = {
+ 'action': 'ping',
+ 'changed': False,
+ 'invocation': {
+ 'module_args': {
+ 'data': 'pong'
+ }
+ },
+ 'ping': 'pong'
+ }
+ generated_module_output = self.fake_ktbw._process_container_output(
+ container_output)
+
+ self.assertNotIn('_ansible_no_log', generated_module_output)
+ self.assertEqual(expected_output, generated_module_output)
+
def test_process_container_output_success(self):
container_output_json = {
'custom_stats': {},
diff --git a/tests/testinfra/test_horizon.py b/tests/testinfra/test_horizon.py
index abdb787c6..9b27e4700 100644
--- a/tests/testinfra/test_horizon.py
+++ b/tests/testinfra/test_horizon.py
@@ -33,9 +33,11 @@ with open("/etc/kolla/passwords.yml", 'r') as file:
def test_horizon_screenshot(host):
firefox_options = webdriver.FirefoxOptions()
+ selenium_url = host.environment().get(
+ 'SELENIUM_REMOTE_URL', 'http://localhost:4500/wd/hub')
driver = webdriver.Remote(
- command_executor='http://localhost:4444/wd/hub',
+ command_executor=selenium_url,
options=firefox_options)
horizon_proto = host.environment().get('HORIZON_PROTO')
@@ -73,20 +75,22 @@ def test_horizon_screenshot(host):
def test_horizon_login(host):
firefox_options = webdriver.FirefoxOptions()
+ selenium_url = host.environment().get(
+ 'SELENIUM_REMOTE_URL', 'http://localhost:4500/wd/hub')
driver = webdriver.Remote(
- command_executor='http://localhost:4444/wd/hub',
+ command_executor=selenium_url,
options=firefox_options)
horizon_proto = host.environment().get('HORIZON_PROTO')
horizon_url = horizon_proto + "://192.0.2.10"
- logout_url = '/'.join((
- horizon_url,
- 'auth',
- 'logout'))
+ login_url = '/'.join((
+ horizon_url,
+ 'auth',
+ 'login'))
try:
- driver.get(logout_url)
+ driver.get(login_url)
user_field = driver.find_element(By.ID, 'id_username')
user_field.send_keys('admin')
pass_field = driver.find_element(By.ID, 'id_password')