diff options
author | Matt Clay <matt@mystile.com> | 2016-11-29 21:21:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-29 21:21:53 -0800 |
commit | 6bbd92e422fcba608cd00ddd38a4c1f03dca301a (patch) | |
tree | 6cd5b7cacb78ddadb41ffe45b5f4ea9c7a1cac79 /test/utils | |
parent | d95eac16ebf2ab8293d91adf39763eead4bf0a2e (diff) | |
download | ansible-6bbd92e422fcba608cd00ddd38a4c1f03dca301a.tar.gz |
Initial ansible-test implementation. (#18556)
Diffstat (limited to 'test/utils')
-rwxr-xr-x | test/utils/shippable/freebsd.sh | 12 | ||||
-rwxr-xr-x | test/utils/shippable/linux.sh | 11 | ||||
-rwxr-xr-x | test/utils/shippable/osx.sh | 12 | ||||
-rwxr-xr-x | test/utils/shippable/other.sh | 15 | ||||
-rwxr-xr-x | test/utils/shippable/shippable.sh | 40 | ||||
-rwxr-xr-x | test/utils/shippable/timing.sh | 5 | ||||
-rwxr-xr-x | test/utils/shippable/units.sh | 7 | ||||
-rwxr-xr-x | test/utils/shippable/windows.sh | 38 |
8 files changed, 140 insertions, 0 deletions
diff --git a/test/utils/shippable/freebsd.sh b/test/utils/shippable/freebsd.sh new file mode 100755 index 0000000000..53b57b152b --- /dev/null +++ b/test/utils/shippable/freebsd.sh @@ -0,0 +1,12 @@ +#!/bin/bash -eux + +set -o pipefail + +declare -a args +IFS='/:' read -ra args <<< "${TEST}" + +platform="${args[0]}" +version="${args[1]}" +target="posix/ci/" + +ansible-test integration --color -v --retry-on-error "${target}" --remote "${platform}/${version}" diff --git a/test/utils/shippable/linux.sh b/test/utils/shippable/linux.sh new file mode 100755 index 0000000000..1d98735c7e --- /dev/null +++ b/test/utils/shippable/linux.sh @@ -0,0 +1,11 @@ +#!/bin/bash -eux + +set -o pipefail + +declare -a args +IFS='/:' read -ra args <<< "${TEST}" + +image="ansible/ansible:${args[1]}" +target="posix/ci/group${args[2]}/" + +ansible-test integration --color -v --retry-on-error "${target}" --docker "${image}" diff --git a/test/utils/shippable/osx.sh b/test/utils/shippable/osx.sh new file mode 100755 index 0000000000..53b57b152b --- /dev/null +++ b/test/utils/shippable/osx.sh @@ -0,0 +1,12 @@ +#!/bin/bash -eux + +set -o pipefail + +declare -a args +IFS='/:' read -ra args <<< "${TEST}" + +platform="${args[0]}" +version="${args[1]}" +target="posix/ci/" + +ansible-test integration --color -v --retry-on-error "${target}" --remote "${platform}/${version}" diff --git a/test/utils/shippable/other.sh b/test/utils/shippable/other.sh new file mode 100755 index 0000000000..aa61e2d49f --- /dev/null +++ b/test/utils/shippable/other.sh @@ -0,0 +1,15 @@ +#!/bin/bash -eux + +set -o pipefail + +add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports universe' +add-apt-repository 'ppa:fkrull/deadsnakes' + +apt-get update -qq +apt-get install python2.4 shellcheck -qq + +pip install tox --disable-pip-version-check + +ansible-test compile --color -v +ansible-test sanity --color -v --tox --skip-test ansible-doc --python 2.7 +ansible-test sanity --color -v --tox --test ansible-doc --coverage diff --git a/test/utils/shippable/shippable.sh b/test/utils/shippable/shippable.sh new file mode 100755 index 0000000000..dd42eb7add --- /dev/null +++ b/test/utils/shippable/shippable.sh @@ -0,0 +1,40 @@ +#!/bin/bash -eux + +set -o pipefail + +declare -a args +IFS='/:' read -ra args <<< "${TEST}" + +script="${args[0]}" + +docker images ansible/ansible +docker ps + +if [ -d /home/shippable/cache/ ]; then + ls -la /home/shippable/cache/ +fi + +which python +python -V + +which pip +pip --version +pip list --disable-pip-version-check + +export PATH="test/runner:${PATH}" +reorganize-tests.sh # temporary solution until repositories are merged + +function cleanup +{ + if [ "$(ls test/results/coverage/)" ]; then + ansible-test coverage xml --color -v --requirements + cp -av test/results/reports/coverage.xml shippable/codecoverage/coverage.xml + fi + + rmdir shippable/testresults/ + cp -av test/results/junit/ shippable/testresults/ +} + +trap cleanup EXIT + +"test/utils/shippable/${script}.sh" diff --git a/test/utils/shippable/timing.sh b/test/utils/shippable/timing.sh new file mode 100755 index 0000000000..bbae07d7b8 --- /dev/null +++ b/test/utils/shippable/timing.sh @@ -0,0 +1,5 @@ +#!/bin/bash -eux + +set -o pipefail + +"$1" 2>&1 | gawk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }' diff --git a/test/utils/shippable/units.sh b/test/utils/shippable/units.sh new file mode 100755 index 0000000000..55f4eeee57 --- /dev/null +++ b/test/utils/shippable/units.sh @@ -0,0 +1,7 @@ +#!/bin/bash -eux + +set -o pipefail + +pip install tox --disable-pip-version-check + +ansible-test units --color -v --tox --coverage diff --git a/test/utils/shippable/windows.sh b/test/utils/shippable/windows.sh new file mode 100755 index 0000000000..3ef4962a7c --- /dev/null +++ b/test/utils/shippable/windows.sh @@ -0,0 +1,38 @@ +#!/bin/bash -eux + +set -o pipefail + +declare -a args +IFS='/:' read -ra args <<< "${TEST}" + +job="${args[1]}" + +ansible-test windows-integration --explain 2>&1 | grep ' windows-integration: .* (targeted)$' > /tmp/windows.txt + +if [ -s /tmp/windows.txt ]; then + echo "Detected changes requiring integration tests specific to Windows:" + cat /tmp/windows.txt + + if [ "${job}" != "1" ]; then + echo "Nothing to do, all Windows tests will run under TEST=windows/1 instead." + exit 0 + fi + + echo "Running Windows integration tests for multiple versions concurrently." + + target="windows/ci/" + + ansible-test windows-integration --color -v --retry-on-error "${target}" --requirements \ + --windows 2008-SP2 \ + --windows 2008-R2_SP1 \ + --windows 2012-RTM \ + --windows 2012-R2_RTM +else + echo "No changes requiring integration tests specific to Windows were detected." + echo "Running Windows integration tests for a single version only." + + target="windows/ci/group${job}/" + + ansible-test windows-integration --color -v --retry-on-error "${target}" --requirements \ + --windows 2012-R2_RTM +fi |