Move integration test properties into the run script

Removes the need for separate properties files and makes bulk
editing of properties easier.
This commit is contained in:
Paul McLanahan 2017-02-22 15:36:26 -05:00
Родитель 828eae0bd3
Коммит 7a4ef8a0bd
11 изменённых файлов: 92 добавлений и 82 удалений

2
Jenkinsfile поставляемый
Просмотреть файл

@ -56,7 +56,7 @@ if ( config.branches.containsKey(env.BRANCH_NAME) ) {
milestone()
stage ('Test Images') {
parallel([
integration_tests: utils.integrationTestJob('local'),
integration_tests: utils.integrationTestJob('smoke'),
unit_tests: {
node {
unstash 'scripts'

Просмотреть файл

@ -1,4 +0,0 @@
export DRIVER=SauceLabs
export BROWSER_NAME=chrome
export PLATFORM="Windows 10"
export MARK_EXPRESSION="not headless"

Просмотреть файл

@ -1,5 +0,0 @@
export DRIVER=SauceLabs
export BROWSER_NAME=firefox
export BROWSER_VERSION=45.0
export PLATFORM="Windows 10"
export MARK_EXPRESSION="not headless"

Просмотреть файл

@ -1 +0,0 @@
export MARK_EXPRESSION=headless

Просмотреть файл

@ -1,4 +0,0 @@
export DRIVER=SauceLabs
export BROWSER_NAME="internet explorer"
export PLATFORM="Windows 10"
export MARK_EXPRESSION="not headless"

Просмотреть файл

@ -1,5 +0,0 @@
export DRIVER=SauceLabs
export BROWSER_NAME="internet explorer"
export BROWSER_VERSION="6.0"
export PLATFORM="Windows XP"
export MARK_EXPRESSION="sanity and not headless"

Просмотреть файл

@ -1,5 +0,0 @@
export DRIVER="SauceLabs"
export BROWSER_NAME="internet explorer"
export BROWSER_VERSION="7.0"
export PLATFORM="Windows XP"
export MARK_EXPRESSION="sanity and not headless"

Просмотреть файл

@ -1,2 +0,0 @@
export DRIVER=Remote
export MARK_EXPRESSION=smoke

Просмотреть файл

@ -1,7 +1,52 @@
#!/bin/bash -xe
# $1 should be the properties file for this run
source "docker/jenkins/properties/integration_tests/${1}.properties"
# $1 should be the properties name for this run
# defaults
DRIVER=SauceLabs
MARK_EXPRESSION="not headless"
case $1 in
chrome)
BROWSER_NAME=chrome
PLATFORM="Windows 10"
;;
firefox)
BROWSER_NAME=firefox
BROWSER_VERSION="45.0"
PLATFORM="Windows 10"
;;
ie)
BROWSER_NAME="internet explorer"
PLATFORM="Windows 10"
;;
ie6)
BROWSER_NAME="internet explorer"
BROWSER_VERSION="6.0"
PLATFORM="Windows XP"
MARK_EXPRESSION="sanity and not headless"
;;
ie7)
BROWSER_NAME="internet explorer"
BROWSER_VERSION="7.0"
PLATFORM="Windows XP"
MARK_EXPRESSION="sanity and not headless"
;;
headless)
DRIVER=
MARK_EXPRESSION=headless
;;
smoke)
DRIVER=Remote
MARK_EXPRESSION=smoke
;;
*)
set +x
echo "Missing or invalid required argument"
echo
echo "Usage: run_integration_tests.sh <chrome|firefox|ie{,6,7}|headless|smoke>"
exit 1
;;
esac
if [[ -z "$GIT_COMMIT" ]]; then
GIT_COMMIT=$(git rev-parse HEAD)
@ -62,21 +107,21 @@ rm -rf "$RESULTS_DIR"
mkdir -p "$RESULTS_DIR"
docker run -v "${RESULTS_DIR}:${DOCKER_RESULTS_DIR}" -u $(stat -c "%u:%g" "$RESULTS_DIR") \
${DOCKER_LINKS[@]} \
-e BASE_URL=${BASE_URL} \
-e DRIVER=${DRIVER} \
-e SAUCELABS_USERNAME=${SAUCELABS_USERNAME} \
-e SAUCELABS_API_KEY=${SAUCELABS_API_KEY} \
-e BROWSER_NAME="${BROWSER_NAME}" \
-e BROWSER_VERSION=${BROWSER_VERSION} \
-e PLATFORM="${PLATFORM}" \
-e SELENIUM_HOST=${SELENIUM_HOST} \
-e SELENIUM_PORT=${SELENIUM_PORT} \
-e SELENIUM_VERSION=${SELENIUM_VERSION} \
-e BUILD_TAG=${BUILD_TAG} \
-e SCREEN_RESOLUTION=${SCREEN_RESOLUTION} \
-e MARK_EXPRESSION="${MARK_EXPRESSION}" \
-e TESTS_PATH="${TESTS_PATH}" \
-e RESULTS_PATH="${DOCKER_RESULTS_DIR}" \
-e PYTEST_PROCESSES=5 \
-e PRIVACY="public restricted" \
-e "BASE_URL=${BASE_URL}" \
-e "DRIVER=${DRIVER}" \
-e "SAUCELABS_USERNAME=${SAUCELABS_USERNAME}" \
-e "SAUCELABS_API_KEY=${SAUCELABS_API_KEY}" \
-e "BROWSER_NAME=${BROWSER_NAME}" \
-e "BROWSER_VERSION=${BROWSER_VERSION}" \
-e "PLATFORM=${PLATFORM}" \
-e "SELENIUM_HOST=${SELENIUM_HOST}" \
-e "SELENIUM_PORT=${SELENIUM_PORT}" \
-e "SELENIUM_VERSION=${SELENIUM_VERSION}" \
-e "BUILD_TAG=${BUILD_TAG}" \
-e "SCREEN_RESOLUTION=${SCREEN_RESOLUTION}" \
-e "MARK_EXPRESSION=${MARK_EXPRESSION}" \
-e "TESTS_PATH=${TESTS_PATH}" \
-e "RESULTS_PATH=${DOCKER_RESULTS_DIR}" \
-e "PYTEST_PROCESSES=5" \
-e "PRIVACY=public restricted" \
mozorg/bedrock_test:${GIT_COMMIT} bin/run-integration-tests.sh

Просмотреть файл

@ -83,10 +83,10 @@ Pipeline integration
--------------------
Our `Jenkinsfile`_ will run the integration tests based on information in our `jenkins.yml file`_.
This file specifies various test names per branch that will cause it to load different
This file specifies various test names per branch that will cause it to use different
parameters, allowing it to be called in many different ways to cover the testing
needs. The job finds the parameters file and executes `this script <https://github.com/mozilla/bedrock/blob/master/docker/jenkins/run_integration_tests.sh>`_,
which then runs `this Docker image <https://github.com/mozilla/bedrock/blob/master/docker/dockerfiles/bedrock_integration_tests>`_,
needs. The job executes `this script <https://github.com/mozilla/bedrock/blob/master/docker/jenkins/run_integration_tests.sh>`_,
which then runs `this Docker image <https://github.com/mozilla/bedrock/blob/master/docker/dockerfiles/bedrock_test>`_,
and ultimately runs `another script <https://github.com/mozilla/bedrock/blob/master/bin/run-integration-tests.sh>`_.
The two scripts can also be executed locally to replicate the way Jenkins operates.
@ -96,7 +96,7 @@ will be used for testing. The ``DRIVER`` parameter is set to ``Remote``, which c
local instance of Selenium Grid to be started in Docker and used for the browser-based
functional UI tests.
The test scripts above will be run once for each properties file specified in the `jenkins.yml file`_
The test scripts above will be run once for each properties name specified in the `jenkins.yml file`_
for the branch being built and tested. Pushes to `master` will run different tests than pushes to `prod`
for example.
@ -123,37 +123,31 @@ default can be set and then can be overridden in the individual job configuratio
Adding test runs
~~~~~~~~~~~~~~~~
Test runs can be added by creating new `properties files`_ with the parameters of the new
test run. These are simply bash syntax files that set environment variables.
For example, if you wanted to run tests in Firefox on both Windows 10 and
OS X, you could create the following files
Test runs can be added by creating a new properties section in the
`integration tests script <https://github.com/mozilla/bedrock/blob/master/docker/jenkins/run_integration_tests.sh>`_
with the parameters of the new test run. This is simply a bash script and you can duplicate a clause of the case staement.
For example, if you wanted to run tests in Firefox on both Windows 10 and
OS X, you could create the following clauses:
win10-firefox.properties
........................
.. code-block:: bash
.. code-block:: none
export DRIVER=SauceLabs
export BROWSER_NAME=firefox
export PLATFORM="Windows 10"
export MARK_EXPRESSION="not headless""
osx-firefox.properties
......................
.. code-block:: none
export DRIVER=SauceLabs
export BROWSER_NAME=firefox
export PLATFORM="OS X 10.11"
export MARK_EXPRESSION="not headless"
case $1 in
osx-firefox)
BROWSER_NAME=firefox
PLATFORM="OS X 10.11"
;;
win10-firefox)
BROWSER_NAME=firefox
PLATFORM="Windows 10"
;;
You can use `Sauce Labs platform configurator`_ to help with the parameter values.
If you have an account on our Jenkins server, you can build the `bedrock_integration_tests_runner`_
job and pass in the ``BASE_URL`` and other parameters of your choosing. This is also useful for
testing against deployed demo environments. For a good baseline, use the values from ``win10-firefox.properties``_
above.
If you have commit rights to our Github repo (mozilla/bedrock) you can simply push
your branch to the branch named ``run-integration-tests``, and the ``bedrock-integration-tests``
app will be deployed and all of the integration tests defined in the ``jenkins.yml``
file for that branch will be run. Please announce in our IRC channel (#www on irc.mozilla.org)
that you'll be doing this so that we don't get conflicts.
Known issues in Jenkins
-----------------------
@ -171,7 +165,6 @@ A `bug for the IRC plugin`_ has been raised.
.. _Sauce Labs: https://saucelabs.com/
.. _Jenkinsfile: https://github.com/mozilla/bedrock/tree/master/Jenkinsfile
.. _jenkins.yml file: https://github.com/mozilla/bedrock/tree/master/jenkins.yml
.. _properties files: https://github.com/mozilla/bedrock/tree/master/docker/jenkins/properties/integration_tests
.. _bedrock_integration_tests_runner: https://ci.us-west.moz.works/view/Bedrock/job/bedrock_integration_tests_runner/
.. _configured in Jenkins: https://ci.us-west.moz.works/configure
.. _become unresponsive: https://issues.jenkins-ci.org/browse/JENKINS-28175

Просмотреть файл

@ -27,16 +27,14 @@ branches:
- ie
- ie6
- ie7
# for testing
deploy-via-jenkinsfile:
run-integration-tests:
regions:
- usw
- euw
apps:
- bedrock-jenkinsfile-test
- bedrock-integration-tests
integration_tests:
- firefox
- headless
- firefox
- chrome
- ie
- ie6