mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
Rename tests to test, use old directory name.
This commit is contained in:
parent
de600f0040
commit
2177b773c8
132 changed files with 0 additions and 0 deletions
2
test/units/inventory_test_data/ansible_hosts
Normal file
2
test/units/inventory_test_data/ansible_hosts
Normal file
|
@ -0,0 +1,2 @@
|
|||
[somegroup]
|
||||
localhost
|
4
test/units/inventory_test_data/common_vars.yml
Normal file
4
test/units/inventory_test_data/common_vars.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
duck: quack
|
||||
cow: moo
|
||||
extguard: " '$favcolor' == 'blue' "
|
95
test/units/inventory_test_data/complex_hosts
Normal file
95
test/units/inventory_test_data/complex_hosts
Normal file
|
@ -0,0 +1,95 @@
|
|||
# order of groups, children, and vars is not signficant
|
||||
# so this example mixes them up for maximum testing
|
||||
|
||||
[nc:children]
|
||||
rtp
|
||||
triangle
|
||||
|
||||
[eastcoast:children]
|
||||
nc
|
||||
florida
|
||||
|
||||
[us:children]
|
||||
eastcoast
|
||||
|
||||
[redundantgroup]
|
||||
rtp_a
|
||||
|
||||
[redundantgroup2]
|
||||
rtp_a
|
||||
|
||||
[redundantgroup3:children]
|
||||
rtp
|
||||
|
||||
[redundantgroup:vars]
|
||||
rga=1
|
||||
|
||||
[redundantgroup2:vars]
|
||||
rgb=2
|
||||
|
||||
[redundantgroup3:vars]
|
||||
rgc=3
|
||||
|
||||
[nc:vars]
|
||||
b=10000
|
||||
c=10001
|
||||
d=10002
|
||||
e = 10003
|
||||
f = 10004 != 10005
|
||||
g = " g "
|
||||
h = ' h '
|
||||
i = ' i "
|
||||
j = " j
|
||||
|
||||
[rtp]
|
||||
rtp_a
|
||||
rtp_b
|
||||
rtp_c
|
||||
|
||||
[rtp:vars]
|
||||
a=1
|
||||
b=2
|
||||
c=3
|
||||
|
||||
[triangle]
|
||||
tri_a
|
||||
tri_b
|
||||
tri_c
|
||||
|
||||
[triangle:vars]
|
||||
a=11
|
||||
b=12
|
||||
c=13
|
||||
|
||||
[florida]
|
||||
orlando
|
||||
miami
|
||||
|
||||
[florida:vars]
|
||||
a=100
|
||||
b=101
|
||||
c=102
|
||||
|
||||
|
||||
[eastcoast:vars]
|
||||
b=100000
|
||||
c=100001
|
||||
d=100002
|
||||
|
||||
[us:vars]
|
||||
c=1000000
|
||||
|
||||
[role1]
|
||||
host[1:2]
|
||||
|
||||
[role2]
|
||||
host[2:3]
|
||||
|
||||
[role3]
|
||||
host[1:3:2]
|
||||
|
||||
[role4]
|
||||
blade-[a:c]-[1:16]
|
||||
blade-[d:z]-[01:16].example.com
|
||||
blade-[1:10]-[1:16]
|
||||
host-e-[10:16].example.net:1234
|
6
test/units/inventory_test_data/hosts_list.yml
Normal file
6
test/units/inventory_test_data/hosts_list.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Test that playbooks support YAML lists of hosts.
|
||||
---
|
||||
- hosts: [host1, host2, host3]
|
||||
connection: local
|
||||
tasks:
|
||||
- action: command true
|
|
@ -0,0 +1,2 @@
|
|||
[test]
|
||||
host[Z:T]
|
|
@ -0,0 +1,2 @@
|
|||
[test]
|
||||
host[1:2][A:B]
|
|
@ -0,0 +1,2 @@
|
|||
[test]
|
||||
host[001:10]
|
|
@ -0,0 +1,2 @@
|
|||
[test]
|
||||
host[1:2:3:4]
|
|
@ -0,0 +1,6 @@
|
|||
[test]
|
||||
[1:2].host
|
||||
[A:B].host
|
||||
|
||||
[test2] # comment
|
||||
[1:3].host
|
|
@ -0,0 +1,2 @@
|
|||
[test]
|
||||
host[1:]
|
41
test/units/inventory_test_data/inventory_api.py
Normal file
41
test/units/inventory_test_data/inventory_api.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option('-l', '--list', default=False, dest="list_hosts", action="store_true")
|
||||
parser.add_option('-H', '--host', default=None, dest="host")
|
||||
parser.add_option('-e', '--extra-vars', default=None, dest="extra")
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
systems = {
|
||||
"ungrouped": [ "jupiter", "saturn" ],
|
||||
"greek": [ "zeus", "hera", "poseidon" ],
|
||||
"norse": [ "thor", "odin", "loki" ],
|
||||
"major-god": [ "zeus", "odin" ],
|
||||
}
|
||||
|
||||
variables = {
|
||||
"thor": {
|
||||
"hammer": True
|
||||
},
|
||||
"zeus": {},
|
||||
}
|
||||
|
||||
if options.list_hosts == True:
|
||||
print json.dumps(systems)
|
||||
sys.exit(0)
|
||||
|
||||
if options.host is not None:
|
||||
if options.extra:
|
||||
k,v = options.extra.split("=")
|
||||
variables[options.host][k] = v
|
||||
print json.dumps(variables[options.host])
|
||||
sys.exit(0)
|
||||
|
||||
parser.print_help()
|
||||
sys.exit(1)
|
3
test/units/inventory_test_data/inventory_dir/0hosts
Normal file
3
test/units/inventory_test_data/inventory_dir/0hosts
Normal file
|
@ -0,0 +1,3 @@
|
|||
zeus var_a=2
|
||||
morpheus
|
||||
thor
|
6
test/units/inventory_test_data/inventory_dir/1mythology
Normal file
6
test/units/inventory_test_data/inventory_dir/1mythology
Normal file
|
@ -0,0 +1,6 @@
|
|||
[greek]
|
||||
zeus
|
||||
morpheus
|
||||
|
||||
[norse]
|
||||
thor
|
6
test/units/inventory_test_data/inventory_dir/2levels
Normal file
6
test/units/inventory_test_data/inventory_dir/2levels
Normal file
|
@ -0,0 +1,6 @@
|
|||
[major-god]
|
||||
zeus var_a=1
|
||||
thor
|
||||
|
||||
[minor-god]
|
||||
morpheus
|
8
test/units/inventory_test_data/inventory_dir/3comments
Normal file
8
test/units/inventory_test_data/inventory_dir/3comments
Normal file
|
@ -0,0 +1,8 @@
|
|||
[major-god] # group with inline comments
|
||||
zeus var_a="1#2" # host with inline comments and "#" in the var string
|
||||
# A comment
|
||||
thor
|
||||
|
||||
[minor-god] # group with inline comment and unbalanced quotes: ' "
|
||||
morpheus # host with inline comments and unbalanced quotes: ' "
|
||||
# A comment with unbalanced quotes: ' "
|
1
test/units/inventory_test_data/large_range
Normal file
1
test/units/inventory_test_data/large_range
Normal file
|
@ -0,0 +1 @@
|
|||
bob[000:142]
|
2
test/units/inventory_test_data/restrict_pattern
Normal file
2
test/units/inventory_test_data/restrict_pattern
Normal file
|
@ -0,0 +1,2 @@
|
|||
odin
|
||||
thor
|
22
test/units/inventory_test_data/simple_hosts
Normal file
22
test/units/inventory_test_data/simple_hosts
Normal file
|
@ -0,0 +1,22 @@
|
|||
jupiter
|
||||
saturn
|
||||
thrudgelmir[:5]
|
||||
|
||||
[greek]
|
||||
zeus
|
||||
hera:3000
|
||||
poseidon
|
||||
cerberus[001:003]
|
||||
cottus[99:100]
|
||||
|
||||
[norse]
|
||||
thor
|
||||
odin
|
||||
loki
|
||||
|
||||
[egyptian]
|
||||
Hotep-[a:c]
|
||||
Bast[C:D]
|
||||
|
||||
[auth]
|
||||
neptun auth="YWRtaW46YWRtaW4="
|
Loading…
Add table
Add a link
Reference in a new issue