summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openstack_dashboard/test/integration_tests/helpers.py4
-rw-r--r--playbooks/horizon-devstack-integration/post.yaml3
-rw-r--r--roles/fetch-video-output/README.rst16
-rw-r--r--roles/fetch-video-output/defaults/main.yaml5
-rw-r--r--roles/fetch-video-output/tasks/main.yaml44
5 files changed, 69 insertions, 3 deletions
diff --git a/openstack_dashboard/test/integration_tests/helpers.py b/openstack_dashboard/test/integration_tests/helpers.py
index 6cb1f24a7..fe84c5fc4 100644
--- a/openstack_dashboard/test/integration_tests/helpers.py
+++ b/openstack_dashboard/test/integration_tests/helpers.py
@@ -263,7 +263,7 @@ class BaseTestCase(testtools.TestCase):
test_log_path = os.path.join(self._test_report_dir, 'test.log')
with self.log_exception("Attach test log"):
with open(test_log_path, 'w') as f:
- f.write(self._log_buffer.getvalue().encode('utf-8'))
+ f.write(self._log_buffer.getvalue())
@contextlib.contextmanager
def log_exception(self, label):
@@ -304,7 +304,7 @@ class BaseTestCase(testtools.TestCase):
display html code generated/changed by javascript.
"""
html_elem = self.driver.find_element_by_tag_name("html")
- return html_elem.get_attribute("innerHTML").encode("utf-8")
+ return html_elem.get_property("innerHTML")
@helpers.pytest_mark('integration')
diff --git a/playbooks/horizon-devstack-integration/post.yaml b/playbooks/horizon-devstack-integration/post.yaml
index 907a248ae..c314e0cba 100644
--- a/playbooks/horizon-devstack-integration/post.yaml
+++ b/playbooks/horizon-devstack-integration/post.yaml
@@ -2,4 +2,5 @@
- hosts: all
roles:
- fetch-tox-output
- - fetch-subunit-output \ No newline at end of file
+ - fetch-subunit-output
+ - fetch-video-output \ No newline at end of file
diff --git a/roles/fetch-video-output/README.rst b/roles/fetch-video-output/README.rst
new file mode 100644
index 000000000..48fd1ef31
--- /dev/null
+++ b/roles/fetch-video-output/README.rst
@@ -0,0 +1,16 @@
+Collect log output from a tox build
+
+**Role Variables**
+
+.. zuul:rolevar:: zuul_work_dir
+ :default: {{ zuul.project.src_dir }}
+
+ Directory tox was run in.
+
+.. zuul:rolevar:: zuul_use_fetch_output
+ :default: false
+
+ Whether to synchronize files to the executor work dir, or to copy them
+ on the test instance.
+ When set to false, the role synchronizes the file to the executor.
+ When set to true, the job needs to use the fetch-output role later.
diff --git a/roles/fetch-video-output/defaults/main.yaml b/roles/fetch-video-output/defaults/main.yaml
new file mode 100644
index 000000000..a305de523
--- /dev/null
+++ b/roles/fetch-video-output/defaults/main.yaml
@@ -0,0 +1,5 @@
+---
+zuul_work_dir: "{{ zuul.project.src_dir }}"
+
+zuul_output_dir: "{{ ansible_user_dir }}/zuul-output"
+zuul_use_fetch_output: "{{ zuul_site_use_fetch_output|default(false) }}"
diff --git a/roles/fetch-video-output/tasks/main.yaml b/roles/fetch-video-output/tasks/main.yaml
new file mode 100644
index 000000000..323e4aade
--- /dev/null
+++ b/roles/fetch-video-output/tasks/main.yaml
@@ -0,0 +1,44 @@
+- name: Set tox log path for multiple nodes
+ set_fact:
+ log_path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/tox"
+ when: groups['all'] | length > 1
+
+- name: Set tox log path for single node
+ set_fact:
+ log_path: "{{ zuul.executor.log_root }}/tox"
+ when: log_path is not defined
+
+- name: Ensure local tox dir
+ file:
+ path: "{{ log_path }}"
+ state: directory
+ delegate_to: localhost
+
+- name: Copy tox logs
+ copy:
+ dest: "{{ zuul_output_dir }}/logs/tox/"
+ src: "{{ zuul_work_dir }}/openstack_dashboard/test/integration_tests/test_reports"
+ remote_src: true
+ loop: "{{ envlist }}"
+ loop_control:
+ loop_var: zj_testenv
+ # some tox runs may not create a virtualenv and thus have
+ # no ./tox/env directory
+ failed_when: false
+ when: zuul_use_fetch_output
+
+- name: Collect tox logs
+ synchronize:
+ dest: "{{ log_path }}"
+ mode: pull
+ src: "{{ zuul_work_dir }}/openstack_dashboard/test/integration_tests/test_reports"
+ verify_host: true
+ owner: no
+ group: no
+ loop: "{{ envlist }}"
+ loop_control:
+ loop_var: zj_testenv
+ # some tox runs may not create a virtualenv and thus have
+ # no ./tox/env directory
+ failed_when: false
+ when: not zuul_use_fetch_output