-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a functional test for larges inventories
- Loading branch information
Showing
5 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
functional-test/src/test/groovy/functional/LargeInventorySpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package functional | ||
|
||
import functional.base.BaseTestConfiguration | ||
import org.testcontainers.spock.Testcontainers | ||
|
||
@Testcontainers | ||
class LargeInventorySpec extends BaseTestConfiguration { | ||
|
||
static String PROJ_NAME = 'ansible-large-inventory' | ||
|
||
def setupSpec() { | ||
startCompose() | ||
configureRundeck(PROJ_NAME) | ||
} | ||
|
||
def "test large inventory"(){ | ||
when: | ||
|
||
//wait for node to be available | ||
waitForNodes(PROJ_NAME) | ||
|
||
def result = client.apiCall {api-> api.listNodes(PROJ_NAME,".*")} | ||
|
||
then: | ||
result!=null | ||
result.size()==8001 | ||
result.get("Node-0")!=null | ||
result.get("Node-0").getAttributes().get("ansible_host") == "ssh-node" | ||
result.get("Node-0").getAttributes().get("ansible_ssh_user") == "rundeck" | ||
result.get("Node-0").getAttributes().get("some-var") == "1234" | ||
result.get("Node-7999")!=null | ||
result.get("Node-7999").getAttributes().get("ansible_host") == "ssh-node" | ||
result.get("Node-7999").getAttributes().get("ansible_ssh_user") == "rundeck" | ||
result.get("Node-7999").getAttributes().get("some-var") == "1234" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
functional-test/src/test/resources/docker/ansible/large-inventory.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
import json | ||
|
||
nodes_meta = {} | ||
nodes = [] | ||
|
||
for x in range(8000): | ||
node_name = "Node-" + str(x) | ||
nodes_meta[node_name] = { | ||
"ansible_ssh_user": "rundeck", | ||
"ansible_host": "ssh-node", | ||
"some-var": "1234" | ||
} | ||
|
||
nodes.append(node_name) | ||
|
||
|
||
output = { | ||
"_meta": { | ||
"hostvars": nodes_meta | ||
}, | ||
"test": { | ||
"hosts": nodes | ||
} | ||
} | ||
|
||
|
||
|
||
print(json.dumps(output)) |
8 changes: 8 additions & 0 deletions
8
...ort/ansible-large-inventory/rundeck-ansible-large-inventory/files/acls/node-acl.aclpolicy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
by: | ||
urn: project:ansible-large-inventory | ||
for: | ||
storage: | ||
- match: | ||
path: 'keys/.*' | ||
allow: [read] | ||
description: Allow access to key storage |
31 changes: 31 additions & 0 deletions
31
...port/ansible-large-inventory/rundeck-ansible-large-inventory/files/etc/project.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#edit below | ||
project.disable.executions=false | ||
project.disable.schedule=false | ||
project.execution.history.cleanup.batch=500 | ||
project.execution.history.cleanup.enabled=false | ||
project.execution.history.cleanup.retention.days=60 | ||
project.execution.history.cleanup.retention.minimum=50 | ||
project.execution.history.cleanup.schedule=0 0 0 1/1 * ? * | ||
project.jobs.gui.groupExpandLevel=1 | ||
project.later.executions.disable.value=0 | ||
project.later.executions.disable=false | ||
project.later.executions.enable.value= | ||
project.later.executions.enable=false | ||
project.later.schedule.disable.value= | ||
project.later.schedule.disable=false | ||
project.later.schedule.enable.value= | ||
project.later.schedule.enable=false | ||
project.name=ansible-large-inventory | ||
project.nodeCache.enabled=true | ||
project.nodeCache.firstLoadSynch=true | ||
project.output.allowUnsanitized=false | ||
project.retry-counter=3 | ||
project.ssh-authentication=privateKey | ||
resources.source.1.type=local | ||
resources.source.2.config.ansible-config-file-path=/home/rundeck/ansible/ansible.cfg | ||
resources.source.2.config.ansible-gather-facts=false | ||
resources.source.2.config.ansible-ignore-errors=true | ||
resources.source.2.config.ansible-inventory=/home/rundeck/ansible/large-inventory.py | ||
resources.source.2.type=com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory | ||
service.FileCopier.default.provider=sshj-scp | ||
service.NodeExecutor.default.provider=sshj-ssh |