1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add a test target for the foreman inventory script (#46837)

Add a test target for the foreman inventory script
This commit is contained in:
jctanner 2018-10-14 20:51:25 -04:00 committed by GitHub
parent db3d920cfd
commit 0b15ad00c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 1 deletions

View file

@ -0,0 +1,2 @@
shippable/cloud/group1
cloud/foreman

View file

@ -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}" "$@"

View file

@ -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" <<FOREMAN_INI
[foreman]
url = http://${FOREMAN_HOST}:${FOREMAN_PORT}
user = ansible-tester
password = secure
ssl_verify = False
FOREMAN_INI
# use ansible to validate the return data
ansible-playbook -i foreman.sh test_foreman_inventory.yml --connection=local

View file

@ -0,0 +1,7 @@
- name: check the foreman inventory script result size and attributes
hosts: localhost
gather_facts: False
tasks:
- assert:
that:
- "{{ groups['all']|length > 900 }}"

View file

@ -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