|
| 1 | +package functional |
| 2 | + |
| 3 | +import functional.base.BaseTestConfiguration |
| 4 | +import org.testcontainers.spock.Testcontainers |
| 5 | + |
| 6 | +@Testcontainers |
| 7 | +class ChildGroupsSpec extends BaseTestConfiguration { |
| 8 | + |
| 9 | + static String NODENAME = 'nodename' |
| 10 | + static String HOSTNAME = 'hostname' |
| 11 | + static String TAGS = 'tags' |
| 12 | + static String PROJ_NAME = 'ansible-child-groups' |
| 13 | + static String NODE_1 = 'one.example.com' |
| 14 | + static String TAGS_1 = 'dbservers, east, prod' |
| 15 | + static String NODE_2 = 'three.example.com' |
| 16 | + static String TAGS_2 = 'dbservers, test, west' |
| 17 | + static String NODE_3 = 'mail.example.com' |
| 18 | + static String TAGS_3 = 'ungrouped' |
| 19 | + |
| 20 | + def setupSpec() { |
| 21 | + startCompose() |
| 22 | + configureRundeck(PROJ_NAME, NODE_1) |
| 23 | + } |
| 24 | + |
| 25 | + void "child groups"() { |
| 26 | + when: |
| 27 | + def result = client.apiCall {api-> api.listNodes(PROJ_NAME,'.*')} |
| 28 | + |
| 29 | + then: |
| 30 | + result != null |
| 31 | + result.size() == 7 |
| 32 | + result.get(NODE_1) != null |
| 33 | + result.get(NODE_1).getAttributes().get(NODENAME) == NODE_1 |
| 34 | + result.get(NODE_1).getAttributes().get(HOSTNAME) == NODE_1 |
| 35 | + result.get(NODE_1).getAttributes().get(TAGS) == TAGS_1 |
| 36 | + result.get(NODE_2) != null |
| 37 | + result.get(NODE_2).getAttributes().get(NODENAME) == NODE_2 |
| 38 | + result.get(NODE_2).getAttributes().get(HOSTNAME) == NODE_2 |
| 39 | + result.get(NODE_2).getAttributes().get(TAGS) == TAGS_2 |
| 40 | + result.get(NODE_3) != null |
| 41 | + result.get(NODE_3).getAttributes().get(NODENAME) == NODE_3 |
| 42 | + result.get(NODE_3).getAttributes().get(HOSTNAME) == NODE_3 |
| 43 | + result.get(NODE_3).getAttributes().get(TAGS) == TAGS_3 |
| 44 | + } |
| 45 | +} |
0 commit comments