aboutsummaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2025-10-21 15:52:34 +0200
committerMichal Nasiadka <mnasiadka@gmail.com>2025-10-27 19:10:22 +0000
commite2a4e6c294e9c23f69445585bbdb32ccd261ff21 (patch)
treefbeeda58ce8d72f3f3b605d9b29dfc8bff585b2b /roles
parent77f7009654a02f38365220656a5d5e7f16836019 (diff)
downloadkolla-ansible-e2a4e6c294e9c23f69445585bbdb32ccd261ff21.tar.gz
kolla-ansible-e2a4e6c294e9c23f69445585bbdb32ccd261ff21.zip
CI: Use selenium in Horizon tests
Change-Id: I814413fdb1a74675846a4ee2d5fbada9592fceef Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
Diffstat (limited to 'roles')
-rw-r--r--roles/kolla-ansible-test-dashboard/tasks/main.yml59
1 files changed, 59 insertions, 0 deletions
diff --git a/roles/kolla-ansible-test-dashboard/tasks/main.yml b/roles/kolla-ansible-test-dashboard/tasks/main.yml
index 561867aed..e09d62a33 100644
--- a/roles/kolla-ansible-test-dashboard/tasks/main.yml
+++ b/roles/kolla-ansible-test-dashboard/tasks/main.yml
@@ -19,3 +19,62 @@
until: dashboard_output.content.find('Login') != -1
retries: 30
delay: 10
+
+- name: Check if testinfra subdirectory exists
+ ansible.builtin.stat:
+ path: "{{ zuul.project.src_dir }}/tests/testinfra"
+ register: testinfra_dir
+
+- name: Run testinfra tests
+ when: testinfra_dir.stat.exists
+ block:
+ - name: Ensure testinfra subdirectory exists
+ ansible.builtin.file:
+ path: "/home/zuul/testinfra"
+ state: directory
+
+ - name: Ensure screenshots directory exists
+ ansible.builtin.file:
+ path: "/home/zuul/testinfra/screenshots"
+ state: directory
+
+ - name: Ensure required packages are installed
+ ansible.builtin.pip:
+ name:
+ - pytest-html
+ - pytest-testinfra
+ - selenium
+ virtualenv: "{{ kolla_ansible_venv_path }}"
+ virtualenv_command: "python3 -m venv"
+
+ - name: Run Selenium Firefox container (Docker)
+ become: true
+ when: container_engine == 'docker'
+ community.docker.docker_container:
+ name: "selenium"
+ detach: true
+ image: "quay.io/opendevmirror/selenium-standalone-firefox:latest"
+ network_mode: host
+
+ - name: Run Selenium Firefox container (Podman)
+ become: true
+ when: container_engine == 'podman'
+ containers.podman.podman_container:
+ name: "selenium"
+ detach: true
+ image: "quay.io/opendevmirror/selenium-standalone-firefox:latest"
+ network_mode: host
+
+ - name: Wait for port 444 to be up
+ ansible.builtin.wait_for:
+ port: 4444
+
+ - name: Run testinfra tests
+ ansible.builtin.shell:
+ cmd: >
+ . {{ kolla_ansible_venv_path }}/bin/activate &&
+ py.test
+ --junit-xml /home/zuul/testinfra/testinfra-junit.xml -o junit_family=xunit1
+ --html=/home/zuul/testinfra/test-results-testinfra.html --self-contained-html
+ -v tests/testinfra
+ chdir: "{{ zuul.project.src_dir }}"