From 16cc3cd5cba71961824ca286c85c45672a8a5585 Mon Sep 17 00:00:00 2001 From: Timur Sufiev Date: Tue, 5 Jan 2016 00:36:11 +0300 Subject: [PATCH] Provide integration test_hooks to be used in gate job Using scripts inside horizon repo in test hooks we could not bother infra folks each time when we need to do some change to test job. The second part of the proposed change is to run these scripts at gate, see https://review.openstack.org/#/c/263457/ Related-Bug: #1526791 Change-Id: Ic2d60df846e876530662046d75c3e56e7841ba30 --- doc/source/topics/testing.rst | 9 +++++++++ tools/gate/integration/post_test_hook.sh | 12 ++++++++++++ tools/gate/integration/pre_test_hook.sh | 4 ++++ 3 files changed, 25 insertions(+) create mode 100755 tools/gate/integration/post_test_hook.sh create mode 100755 tools/gate/integration/pre_test_hook.sh diff --git a/doc/source/topics/testing.rst b/doc/source/topics/testing.rst index f9864b8ad3..1c97f5d279 100644 --- a/doc/source/topics/testing.rst +++ b/doc/source/topics/testing.rst @@ -301,7 +301,16 @@ which also contains instructions on how to run the tests. To make integration tests more understandable and maintainable, the Page Object pattern is used throughout them. +Horizon repository also provides two shell `scripts`_, which are executed in +pre_test_hook and post_test_hook respectively. Pre hook is generally used for +modifying test environment, while post hook is used for running actual +integration tests with tox and collecting test artifacts. Thanks to the +incorporating all modifications to tests into Horizon repository, one can alter +both tests and test environment and see the immediate results in Jenkins job +output. + .. _here: https://github.com/openstack/horizon/tree/master/openstack_dashboard/test/integration_tests +.. _scripts: https://github.com/openstack/horizon/tree/master/tools/gate/integration Page Object pattern ------------------- diff --git a/tools/gate/integration/post_test_hook.sh b/tools/gate/integration/post_test_hook.sh new file mode 100755 index 0000000000..ddb64e2697 --- /dev/null +++ b/tools/gate/integration/post_test_hook.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# This script will be executed inside post_test_hook function in devstack gate + +cd /opt/stack/new/horizon +sudo -H -u stack tox -e py27integration +retval=$? +if [ -d openstack_dashboard/test/integration_tests/integration_tests_screenshots/ ]; then + cp -r openstack_dashboard/test/integration_tests/integration_tests_screenshots/ /home/jenkins/workspace/gate-horizon-dsvm-integration/ +fi +exit $retval + diff --git a/tools/gate/integration/pre_test_hook.sh b/tools/gate/integration/pre_test_hook.sh new file mode 100755 index 0000000000..949c990196 --- /dev/null +++ b/tools/gate/integration/pre_test_hook.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# This script will be executed inside pre_test_hook function in devstack gate +