From 0b15ad00c141479ac3c2a0d40721939041ef3a7f Mon Sep 17 00:00:00 2001 From: jctanner Date: Sun, 14 Oct 2018 20:51:25 -0400 Subject: [PATCH] Add a test target for the foreman inventory script (#46837) Add a test target for the foreman inventory script --- .../targets/inventory_foreman_script/aliases | 2 ++ .../inventory_foreman_script/foreman.sh | 10 ++++++++++ .../targets/inventory_foreman_script/runme.sh | 18 ++++++++++++++++++ .../test_foreman_inventory.yml | 7 +++++++ test/runner/lib/cloud/foreman.py | 2 +- 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/integration/targets/inventory_foreman_script/aliases create mode 100755 test/integration/targets/inventory_foreman_script/foreman.sh create mode 100755 test/integration/targets/inventory_foreman_script/runme.sh create mode 100644 test/integration/targets/inventory_foreman_script/test_foreman_inventory.yml diff --git a/test/integration/targets/inventory_foreman_script/aliases b/test/integration/targets/inventory_foreman_script/aliases new file mode 100644 index 00000000000..64483bbb69b --- /dev/null +++ b/test/integration/targets/inventory_foreman_script/aliases @@ -0,0 +1,2 @@ +shippable/cloud/group1 +cloud/foreman diff --git a/test/integration/targets/inventory_foreman_script/foreman.sh b/test/integration/targets/inventory_foreman_script/foreman.sh new file mode 100755 index 00000000000..70d7a99811f --- /dev/null +++ b/test/integration/targets/inventory_foreman_script/foreman.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Wrapper to use the correct Python interpreter and support code coverage. + +REL_SCRIPT="../../../../contrib/inventory/foreman.py" +ABS_SCRIPT="$("${ANSIBLE_TEST_PYTHON_INTERPRETER}" -c "import os; print(os.path.abspath('${REL_SCRIPT}'))")" + +# Make sure output written to current directory ends up in the temp dir. +cd "${OUTPUT_DIR}" + +python.py "${ABS_SCRIPT}" "$@" diff --git a/test/integration/targets/inventory_foreman_script/runme.sh b/test/integration/targets/inventory_foreman_script/runme.sh new file mode 100755 index 00000000000..86298f872c5 --- /dev/null +++ b/test/integration/targets/inventory_foreman_script/runme.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -euo pipefail + +export FOREMAN_HOST="${FOREMAN_HOST:-localhost}" +export FOREMAN_PORT="${FOREMAN_PORT:-8080}" +export FOREMAN_INI_PATH="${OUTPUT_DIR}/foreman.ini" + +cat > "$FOREMAN_INI_PATH" < 900 }}" diff --git a/test/runner/lib/cloud/foreman.py b/test/runner/lib/cloud/foreman.py index ca05bbadfc9..892fe84af01 100644 --- a/test/runner/lib/cloud/foreman.py +++ b/test/runner/lib/cloud/foreman.py @@ -31,7 +31,7 @@ class ForemanProvider(CloudProvider): DOCKER_SIMULATOR_NAME = 'foreman-stub' - DOCKER_IMAGE = 'quay.io/ansible/foreman-test-container:1.3.1' + DOCKER_IMAGE = 'quay.io/ansible/foreman-test-container:1.4.0' """Default image to run Foreman stub from. The simulator must be pinned to a specific version