Skip to content

Commit

Permalink
Initial support for module integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclay committed Jul 7, 2016
1 parent f176b76 commit df4bfb4
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
25 changes: 25 additions & 0 deletions shippable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: python

env:
matrix:
- TEST=none

matrix:
exclude:
- env: TEST=none
include:
- env: TEST=integration
build:
pre_ci_boot:
options: "--privileged=false --net=bridge"
ci:
- test/utils/shippable/ci.sh

integrations:
notifications:
- integrationName: email
type: email
on_success: never
on_failure: never
on_start: never
on_pull_request: never
7 changes: 7 additions & 0 deletions test/utils/shippable/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -eux

set -o pipefail

source_root=$(python -c "from os import path; print(path.abspath(path.join(path.dirname('$0'), '../../..')))")

"${source_root}/test/utils/shippable/${TEST}.sh" 2>&1 | gawk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }'
51 changes: 51 additions & 0 deletions test/utils/shippable/integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash -eux

set -o pipefail

ansible_repo_url="https://github.com/ansible/ansible.git"

is_pr="${IS_PULL_REQUEST}"
build_dir="${SHIPPABLE_BUILD_DIR}"
repo="${REPO_NAME}"

if [ "${is_pr}" != "true" ]; then
echo "Module integration tests are only supported on pull requests."
exit 1
fi

case "${repo}" in
"ansible-modules-core")
this_module_group="core"
other_module_group="extras"
;;
"ansible-modules-extras")
this_module_group="extras"
other_module_group="core"
;;
*)
echo "Unsupported repo name: ${repo}"
exit 1
;;
esac

modules_tmp_dir="${build_dir}.tmp"
this_modules_dir="${build_dir}/lib/ansible/modules/${this_module_group}"
other_modules_dir="${build_dir}/lib/ansible/modules/${other_module_group}"

cd /
mv "${build_dir}" "${modules_tmp_dir}"
git clone "${ansible_repo_url}" "${build_dir}"
cd "${build_dir}"
rmdir "${this_modules_dir}"
mv "${modules_tmp_dir}" "${this_modules_dir}"
mv "${this_modules_dir}/shippable" "${build_dir}"
git submodule init "${other_modules_dir}"
git submodule sync "${other_modules_dir}"
git submodule update "${other_modules_dir}"

pip install -r test/utils/shippable/modules/generate-tests-requirements.txt --upgrade
pip list

source hacking/env-setup

test/utils/shippable/modules/generate-tests "${this_module_group}" --verbose | /bin/bash -eux

0 comments on commit df4bfb4

Please sign in to comment.