diff options
author | Tim Burke <tim.burke@gmail.com> | 2018-01-11 16:24:24 -0800 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2021-03-01 10:09:03 -0800 |
commit | c5152ed4d3a37c5e0017be9f0445bf0868561b96 (patch) | |
tree | 0e7dc25d05978bc88ba99659868861d155693c73 /tools | |
parent | 5c3eb488f2df5a93a9899a406fc9a4658efb272b (diff) | |
download | swift-c5152ed4d3a37c5e0017be9f0445bf0868561b96.tar.gz |
Add some functional CORS tests
If you've got selenium installed (and working), the whole thing can be
automated pretty well; run main.py, wait while some windows pop up (or
use xvfb-run to run things on a virtual display), then check out what
tests were run on which browsers and whether any of them failed. Exit
code is the number of failed tests.
Includes tests against:
- Account
- Containers, with various ACLs/CORS settings
- Objects
- /info
- SLOs
- DLOs
- Symlinks
Include a gate job that runs the tests in firefox.
Areas for future work:
- Install chromium and chromedriver in the gate; tests should
automatically pick up on the fact that it's available
- Capture the web browser's console logs, too, so we can get
more info when things go wrong
Change-Id: Ic1d3a062419f1133c6e2f00a598867d567358c9f
Diffstat (limited to 'tools')
-rw-r--r-- | tools/playbooks/cors/install_selenium.yaml | 30 | ||||
-rw-r--r-- | tools/playbooks/cors/post.yaml | 25 | ||||
-rw-r--r-- | tools/playbooks/cors/run.yaml | 15 |
3 files changed, 70 insertions, 0 deletions
diff --git a/tools/playbooks/cors/install_selenium.yaml b/tools/playbooks/cors/install_selenium.yaml new file mode 100644 index 000000000..682c36a87 --- /dev/null +++ b/tools/playbooks/cors/install_selenium.yaml @@ -0,0 +1,30 @@ +- hosts: all + become: true + tasks: + - name: install virtual frame buffer + yum: + name: xorg-x11-server-Xvfb + state: present + - name: install selenium + pip: + name: selenium + state: present + - name: install firefox + yum: + name: firefox + state: present + - name: fetch firefox driver + get_url: + url: https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz + dest: /tmp/geckodriver.tar.gz + - name: unpack firefox driver + unarchive: + src: /tmp/geckodriver.tar.gz + dest: /usr/local/bin + remote_src: true + - name: check firefox version + command: firefox --version + #- name: install chromium + # yum: + # name: chromium-headless + # state: present diff --git a/tools/playbooks/cors/post.yaml b/tools/playbooks/cors/post.yaml new file mode 100644 index 000000000..b0e4ba438 --- /dev/null +++ b/tools/playbooks/cors/post.yaml @@ -0,0 +1,25 @@ +- hosts: all + become: true + tasks: + - name: Copy geckodriver log from worker nodes to executor node + synchronize: + src: '{{ ansible_env.HOME }}/geckodriver.log' + dest: '{{ zuul.executor.log_root }}' + mode: pull + copy_links: true + verify_host: true + + - name: Copy CORS tests output from worker nodes to executor node + synchronize: + src: '{{ ansible_env.HOME }}/cors-test-results.txt' + dest: '{{ zuul.executor.log_root }}' + mode: pull + copy_links: true + verify_host: true + + - zuul_return: + data: + zuul: + artifacts: + - name: CORS test results + url: cors-test-results.txt diff --git a/tools/playbooks/cors/run.yaml b/tools/playbooks/cors/run.yaml new file mode 100644 index 000000000..a6076f82d --- /dev/null +++ b/tools/playbooks/cors/run.yaml @@ -0,0 +1,15 @@ +- hosts: all + tasks: + - name: Shutdown main swift services + shell: "swift-init stop main" + ignore_errors: true + + - name: Start main swift services + shell: "swift-init start main" + + - name: Run CORS tests + shell: > + xvfb-run python + {{ ansible_env.HOME }}/{{ zuul.project.src_dir }}/test/cors/main.py + --output {{ ansible_env.HOME }}/cors-test-results.txt + all |