-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathInventoryListSpec.groovy
More file actions
50 lines (40 loc) · 1.7 KB
/
InventoryListSpec.groovy
File metadata and controls
50 lines (40 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package functional
import functional.base.BaseTestConfiguration
import org.testcontainers.spock.Testcontainers
@Testcontainers
class InventoryListSpec extends BaseTestConfiguration {
static String PROJ_NAME = 'ansible-large-inventory'
def setupSpec() {
startCompose()
configureRundeck(PROJ_NAME, "Node-0")
}
def "test large inventory"(){
when:
def result = client.apiCall {api-> api.listNodes(PROJ_NAME,"tags:test")}
then:
result!=null
result.size()==8000
result.get("Node-0")!=null
// ansible_ prefixed variables should be filtered out, not in attributes
result.get("Node-0").getAttributes().get("ansible_host") == null
result.get("Node-0").getAttributes().get("ansible_ssh_user") == null
// custom variables should still be imported
result.get("Node-0").getAttributes().get("some-var") == "1234"
result.get("Node-7999")!=null
result.get("Node-7999").getAttributes().get("ansible_host") == null
result.get("Node-7999").getAttributes().get("ansible_ssh_user") == null
result.get("Node-7999").getAttributes().get("some-var") == "1234"
}
def "test empty inventory path"(){
when:
def result = client.apiCall {api-> api.listNodes(PROJ_NAME,"tags:fake")}
then:
result!=null
result.size()==35
result.get("node1")!=null
// ansible_ prefixed variables should be filtered out, not in attributes
result.get("node1").getAttributes().get("ansible_host") == null
result.get("node1").getAttributes().get("ansible_user") == null
result.get("node1").getAttributes().get("ansible_port") == null
}
}