docker_swarm inventory plugin: extend tests (#53913)

* Extend tests.

* Update BOTMETA so that docker* inventory tests are associated with .
This commit is contained in:
Felix Fontein 2019-03-17 11:28:55 +01:00 committed by John R Barker
parent f20575e2a8
commit 35b295f6af
5 changed files with 32 additions and 1 deletions

6
.github/BOTMETA.yml vendored
View file

@ -1115,7 +1115,7 @@ files:
# plugins/inventory # plugins/inventory
$plugins/inventory/__init__.py: $plugins/inventory/__init__.py:
support: core support: core
$plugins/inventory/docker_swarm.py: *docker $plugins/inventory/docker: *docker
$plugins/inventory/gcp_compute.py: $plugins/inventory/gcp_compute.py:
maintainers: $team_google maintainers: $team_google
supershipit: $team_google supershipit: $team_google
@ -1327,6 +1327,10 @@ files:
test/integration/targets/gcp: test/integration/targets/gcp:
maintainers: $team_google maintainers: $team_google
supershipit: $team_google supershipit: $team_google
test/integration/targets/inventory_docker: *docker
test/integration/targets/inventory_docker_swarm:
<<: *docker
maintainers: $team_docker morph027
test/integration/targets/meraki: *meraki test/integration/targets/meraki: *meraki
test/integration/targets/mso: *aci test/integration/targets/mso: *aci
test/integration/targets/mysql: *mysql test/integration/targets/mysql: *mysql

View file

@ -0,0 +1,5 @@
---
plugin: docker_swarm
host: unix://var/run/docker.sock
verbose_output: no
include_host_uri: yes

View file

@ -29,6 +29,10 @@
debug: debug:
var: ansible_host var: ansible_host
- name: Make sure docker_swarm_node_attributes is available
assert:
that:
- docker_swarm_node_attributes is not undefined
- name: Print docker_swarm_node_attributes per host - name: Print docker_swarm_node_attributes per host
debug: debug:
var: docker_swarm_node_attributes var: docker_swarm_node_attributes

View file

@ -0,0 +1,15 @@
---
- hosts: all
connection: local # otherwise Ansible will complain that it cannot connect via ssh to 127.0.0.1:22
tasks:
- name: Make sure docker_swarm_node_attributes is not available
assert:
that:
- docker_swarm_node_attributes is undefined
- name: Make sure ansible_host_uri is available
assert:
that:
- ansible_host_uri is defined
- name: Print ansible_host_uri
debug:
var: ansible_host_uri

View file

@ -18,3 +18,6 @@ ansible-playbook playbooks/swarm_setup.yml
echo "Test docker_swarm inventory 1" echo "Test docker_swarm inventory 1"
ansible-playbook -i inventory_1.docker_swarm.yml playbooks/test_inventory_1.yml ansible-playbook -i inventory_1.docker_swarm.yml playbooks/test_inventory_1.yml
echo "Test docker_swarm inventory 2"
ansible-playbook -i inventory_2.docker_swarm.yml playbooks/test_inventory_2.yml