mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
Split integration tests out from Makefile. (#17976)
This commit is contained in:
parent
bf3d546d9a
commit
80a5c70ad7
169 changed files with 612 additions and 420 deletions
6
test/integration/targets/group_by/inventory.group_by
Normal file
6
test/integration/targets/group_by/inventory.group_by
Normal file
|
@ -0,0 +1,6 @@
|
|||
[lamini]
|
||||
alpaca genus=vicugna
|
||||
llama genus=lama
|
||||
|
||||
[lamini:vars]
|
||||
ansible_connection=local
|
5
test/integration/targets/group_by/runme.sh
Executable file
5
test/integration/targets/group_by/runme.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
ansible-playbook test_group_by.yml -i inventory.group_by -v "$@"
|
127
test/integration/targets/group_by/test_group_by.yml
Normal file
127
test/integration/targets/group_by/test_group_by.yml
Normal file
|
@ -0,0 +1,127 @@
|
|||
# test code for the group_by module
|
||||
# (c) 2014, Chris Church <cchurch@ansible.com>
|
||||
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Create overall groups
|
||||
hosts: lamini
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- debug: var=genus
|
||||
- name: group by genus
|
||||
group_by: key={{ genus }}
|
||||
|
||||
- name: group by first three letters of genus with key in quotes
|
||||
group_by: key="{{ genus | truncate(3, true, '') }}"
|
||||
|
||||
- name: group by first two letters of genus with key not in quotes
|
||||
group_by: key={{ genus | truncate(2, true, '') }}
|
||||
|
||||
- name: group by genus in uppercase using complex args
|
||||
group_by: { key: "{{ genus | upper() }}" }
|
||||
|
||||
- name: Vicunga group validation
|
||||
hosts: vicugna
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: verify that only the alpaca is in this group
|
||||
assert: { that: "inventory_hostname == 'alpaca'" }
|
||||
- name: set a fact to check that we ran this play
|
||||
set_fact: genus_vicugna=true
|
||||
|
||||
- name: Lama group validation
|
||||
hosts: lama
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: verify that only the llama is in this group
|
||||
assert: { that: "inventory_hostname == 'llama'" }
|
||||
- name: set a fact to check that we ran this play
|
||||
set_fact: genus_lama=true
|
||||
|
||||
- name: Vic group validation
|
||||
hosts: vic
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: verify that only the alpaca is in this group
|
||||
assert: { that: "inventory_hostname == 'alpaca'" }
|
||||
- name: set a fact to check that we ran this play
|
||||
set_fact: genus_vic=true
|
||||
|
||||
- name: Lam group validation
|
||||
hosts: lam
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: verify that only the llama is in this group
|
||||
assert: { that: "inventory_hostname == 'llama'" }
|
||||
- name: set a fact to check that we ran this play
|
||||
set_fact: genus_lam=true
|
||||
|
||||
- name: Vi group validation
|
||||
hosts: vi
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: verify that only the alpaca is in this group
|
||||
assert: { that: "inventory_hostname == 'alpaca'" }
|
||||
- name: set a fact to check that we ran this play
|
||||
set_fact: genus_vi=true
|
||||
|
||||
- name: La group validation
|
||||
hosts: la
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: verify that only the llama is in this group
|
||||
assert: { that: "inventory_hostname == 'llama'" }
|
||||
- name: set a fact to check that we ran this play
|
||||
set_fact: genus_la=true
|
||||
|
||||
- name: VICUGNA group validation
|
||||
hosts: VICUGNA
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: verify that only the alpaca is in this group
|
||||
assert: { that: "inventory_hostname == 'alpaca'" }
|
||||
- name: set a fact to check that we ran this play
|
||||
set_fact: genus_VICUGNA=true
|
||||
|
||||
- name: LAMA group validation
|
||||
hosts: LAMA
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: verify that only the llama is in this group
|
||||
assert: { that: "inventory_hostname == 'llama'" }
|
||||
- name: set a fact to check that we ran this play
|
||||
set_fact: genus_LAMA=true
|
||||
|
||||
- name: genus group validation (expect skipped)
|
||||
hosts: 'genus'
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: no hosts should match this group
|
||||
fail: msg="should never get here"
|
||||
|
||||
- name: alpaca validation of groups
|
||||
hosts: alpaca
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: check that alpaca matched all four groups
|
||||
assert: { that: ["genus_vicugna", "genus_vic", "genus_vi", "genus_VICUGNA"] }
|
||||
|
||||
- name: llama validation of groups
|
||||
hosts: llama
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: check that llama matched all four groups
|
||||
assert: { that: ["genus_lama", "genus_lam", "genus_la", "genus_LAMA"] }
|
Loading…
Add table
Add a link
Reference in a new issue