Browse Source

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
changes/78/767078/4
Ian Wienand 1 year ago committed by Clark Boylan
parent
commit
be085e564e
  1. 6
      playbooks/roles/run-selenium/README.rst
  2. 5
      playbooks/roles/run-selenium/tasks/main.yaml
  3. 19
      playbooks/zuul/run-base.yaml
  4. 1
      tox.ini
  5. 1
      zuul.d/system-config-run.yaml

6
playbooks/roles/run-selenium/README.rst

@ -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.

5
playbooks/roles/run-selenium/tasks/main.yaml

@ -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

19
playbooks/zuul/run-base.yaml

@ -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

1
tox.ini

@ -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 =

1
zuul.d/system-config-run.yaml

@ -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,

Loading…
Cancel
Save