summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorAnsible Core Team <info@ansible.com>2020-03-09 10:40:32 +0100
committerMatt Martz <matt@sivel.net>2020-03-23 17:14:21 +0100
commit0743e733bbbbaed9e02699654e4d307233cffadf (patch)
tree6959b67f515905f3aae08ff84998f63b00879727 /test/integration
parentMigrated to fortinet.fortios (diff)
downloadansible-0743e733bbbbaed9e02699654e4d307233cffadf.tar.xz
ansible-0743e733bbbbaed9e02699654e4d307233cffadf.zip
Migrated to theforeman.foreman
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/targets/inventory_foreman/aliases3
-rw-r--r--test/integration/targets/inventory_foreman/ansible.cfg5
-rw-r--r--test/integration/targets/inventory_foreman/inspect_cache.yml31
-rwxr-xr-xtest/integration/targets/inventory_foreman/runme.sh50
-rw-r--r--test/integration/targets/inventory_foreman/test_foreman_inventory.yml59
5 files changed, 0 insertions, 148 deletions
diff --git a/test/integration/targets/inventory_foreman/aliases b/test/integration/targets/inventory_foreman/aliases
deleted file mode 100644
index 641e938ad2..0000000000
--- a/test/integration/targets/inventory_foreman/aliases
+++ /dev/null
@@ -1,3 +0,0 @@
-shippable/cloud/group1
-cloud/foreman
-destructive
diff --git a/test/integration/targets/inventory_foreman/ansible.cfg b/test/integration/targets/inventory_foreman/ansible.cfg
deleted file mode 100644
index 63e24c4bd0..0000000000
--- a/test/integration/targets/inventory_foreman/ansible.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[defaults]
-inventory = test-config.foreman.yaml
-
-[inventory]
-enable_plugins = foreman
diff --git a/test/integration/targets/inventory_foreman/inspect_cache.yml b/test/integration/targets/inventory_foreman/inspect_cache.yml
deleted file mode 100644
index c91f4c3868..0000000000
--- a/test/integration/targets/inventory_foreman/inspect_cache.yml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-- hosts: localhost
- vars:
- foreman_stub_host: "{{ lookup('env', 'FOREMAN_HOST') }}"
- foreman_stub_port: "{{ lookup('env', 'FOREMAN_PORT') }}"
- foreman_stub_api_path: /api/v2
- cached_hosts_key: "http://{{ foreman_stub_host }}:{{ foreman_stub_port }}{{ foreman_stub_api_path }}/hosts"
- tasks:
- - name: verify a cache file was created
- find:
- path:
- - ./foreman_cache
- register: matching_files
-
- - assert:
- that:
- - matching_files.matched == 1
- - name: read the cached inventory
- set_fact:
- contents: "{{ lookup('file', matching_files.files.0.path) }}"
-
- - name: extract all the host names
- set_fact:
- cached_hosts: "{{ contents[cached_hosts_key] | json_query('[*].name') }}"
-
- - assert:
- that:
- "'{{ item }}' in cached_hosts"
- loop:
- - "v6.example-780.com"
- - "c4.j1.y5.example-487.com"
diff --git a/test/integration/targets/inventory_foreman/runme.sh b/test/integration/targets/inventory_foreman/runme.sh
deleted file mode 100755
index ba94a9360f..0000000000
--- a/test/integration/targets/inventory_foreman/runme.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-
-[[ -n "$DEBUG" || -n "$ANSIBLE_DEBUG" ]] && set -x
-
-set -euo pipefail
-
-export ANSIBLE_INVENTORY
-export ANSIBLE_PYTHON_INTERPRETER
-
-unset ANSIBLE_INVENTORY
-unset ANSIBLE_PYTHON_INTERPRETER
-
-export ANSIBLE_CONFIG=ansible.cfg
-export FOREMAN_HOST="${FOREMAN_HOST:-localhost}"
-export FOREMAN_PORT="${FOREMAN_PORT:-8080}"
-FOREMAN_CONFIG=test-config.foreman.yaml
-
-# Set inventory caching environment variables to populate a jsonfile cache
-export ANSIBLE_INVENTORY_CACHE=True
-export ANSIBLE_INVENTORY_CACHE_PLUGIN=jsonfile
-export ANSIBLE_INVENTORY_CACHE_CONNECTION=./foreman_cache
-
-# flag for checking whether cleanup has already fired
-_is_clean=
-
-function _cleanup() {
- [[ -n "$_is_clean" ]] && return # don't double-clean
- echo Cleanup: removing $FOREMAN_CONFIG...
- rm -vf "$FOREMAN_CONFIG"
- unset ANSIBLE_CONFIG
- unset FOREMAN_HOST
- unset FOREMAN_PORT
- unset FOREMAN_CONFIG
- _is_clean=1
-}
-trap _cleanup INT TERM EXIT
-
-cat > "$FOREMAN_CONFIG" <<FOREMAN_YAML
-plugin: foreman
-url: http://${FOREMAN_HOST}:${FOREMAN_PORT}
-user: ansible-tester
-password: secure
-validate_certs: False
-FOREMAN_YAML
-
-ansible-playbook test_foreman_inventory.yml --connection=local "$@"
-ansible-playbook inspect_cache.yml --connection=local "$@"
-
-# remove inventory cache
-rm -r ./foreman_cache
diff --git a/test/integration/targets/inventory_foreman/test_foreman_inventory.yml b/test/integration/targets/inventory_foreman/test_foreman_inventory.yml
deleted file mode 100644
index d5eeed4f8b..0000000000
--- a/test/integration/targets/inventory_foreman/test_foreman_inventory.yml
+++ /dev/null
@@ -1,59 +0,0 @@
----
-- hosts: localhost
- vars:
- foreman_stub_host: "{{ lookup('env', 'FOREMAN_HOST') }}"
- foreman_stub_port: "{{ lookup('env', 'FOREMAN_PORT') }}"
- foreman_stub_api_path: /api/v2
- foreman_stub_host_uri: "http://{{ foreman_stub_host }}:{{ foreman_stub_port }}"
- foreman_stub_api_uri: "{{ foreman_stub_host_uri }}{{ foreman_stub_api_path }}"
- foreman_stub_heartbeat_uri: "{{ foreman_stub_host_uri }}/ping"
- tasks:
- - debug:
- msg: >-
- Foreman host: {{ foreman_stub_host }} |
- Foreman port: {{ foreman_stub_port }} |
- API path: {{ foreman_stub_api_path }} |
- Foreman API URL: {{ foreman_stub_api_uri }}
-
- - name: Wait for Foreman API stub to come up online
- wait_for:
- host: "{{ foreman_stub_host }}"
- port: "{{ foreman_stub_port }}"
- state: started
-
- # smoke test that flask app is serving
- - name: Smoke test HTTP response from Foreman stub
- uri:
- url: "{{ foreman_stub_heartbeat_uri }}"
- return_content: yes
- register: heartbeat_resp
- failed_when: >
- heartbeat_resp.json.status != 'ok' or heartbeat_resp.json.response != 'pong'
-
- #### Testing start
- - name: >
- Check that there are 'foreman_pgagne_sats' and 'foreman_base'
- groups present in inventory
- assert:
- that: >
- '{{ item }}' in groups
- with_items:
- - foreman_pgagne_sats
- - foreman_base
-
- - name: Check that host are in appropriate groups
- assert:
- that: >
- '{{ item.key }}' in groups['{{ item.value }}']
- with_dict:
- v6.example-780.com: foreman_base
- c4.j1.y5.example-487.com: ungrouped
-
- - name: Check host UUIDs
- assert:
- that: >
- hostvars['{{ item.key }}']['foreman_subscription_facet_attributes']['uuid'] == '{{ item.value }}'
- with_dict:
- v6.example-780.com: 2c72fa49-995a-4bbf-bda0-684c7048ad9f
- c4.j1.y5.example-487.com: 0a494b6e-7e90-4ed2-8edc-43a41436a242
- #### Testing end