run-selenium: run selenium on a node

This runs selenium from a container on a node, and exposes port 4444
so you can issue commands to it.  This is used in the follow-on
I56cda99790d3c172e10b664e57abeca10efc5566 to take some screenshots of
gerrit.

Change-Id: Idcbcd9a8f33bd86b5f3e546dd563792212e0751b
This commit is contained in:
Ian Wienand 2020-12-15 15:22:26 +11:00 committed by Clark Boylan
parent 4d41c1002c
commit be085e564e
5 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,6 @@
run-selenium
Run a selenium container that listens on port 4444 on a host.
This is intended only for use during gate testing to capture
screenshots from a local service. Usually used from testinfra jobs.

View File

@ -0,0 +1,5 @@
- name: Run selenium container
shell:
executable: /bin/sh
cmd: |
docker run -d --network="host" -v /dev/shm:/dev/shm selenium/standalone-firefox:4.0.0-beta-1-prerelease-20201202

View File

@ -41,7 +41,11 @@
bastion_ipv4: "{{ nodepool['public_ipv4'] }}"
bastion_ipv6: "{{ nodepool['public_ipv6'] }}"
bastion_public_key: "{{ lookup('file', zuul.executor.work_root + '/' + zuul.build + '_id_rsa.pub') }}"
iptables_test_public_tcp_ports: [19885]
iptables_test_public_tcp_ports:
# Zuul web console
- 19885
# selenium
- 4444
template:
src: "templates/{{ item }}.j2"
dest: "/etc/ansible/hosts/{{ item }}"
@ -107,6 +111,19 @@
content: "{{ testinfra_extra_data | default('') | to_nice_yaml(indent=2) }}"
dest: '/home/zuul/testinfra_extra_data_fixture.yaml'
- name: Make screenshots directory
file:
path: '/var/log/screenshots'
state: directory
- name: Return screenshots artifact
zuul_return:
data:
zuul:
artifacts:
- name: Screenshots
url: "bridge.openstack.org/screenshots"
- name: Run and collect testinfra
block:
- name: Run testinfra to validate configuration

View File

@ -41,6 +41,7 @@ deps =
ansible-base # see install-ansible/tasks/main.yaml
pytest-html # MPL-2.0
pytest-testinfra>=6.0.0
selenium
# This environment assumes a gate-hosts.yaml file has been written.
passenv =

View File

@ -25,6 +25,7 @@
'{{ zuul.project.src_dir }}/junit.xml': logs
'{{ zuul.project.src_dir }}/test-results.html': logs
'{{ zuul.project.src_dir }}/inventory/base/gate-hosts.yaml': logs
'/var/log/screenshots': logs
# Note: the following two jobs implement the variant-based multiple
# inheritance trick. Both of these variants will always apply,