diff --git a/functional-test/src/test/groovy/functional/LargeInventorySpec.groovy b/functional-test/src/test/groovy/functional/InventoryListSpec.groovy similarity index 63% rename from functional-test/src/test/groovy/functional/LargeInventorySpec.groovy rename to functional-test/src/test/groovy/functional/InventoryListSpec.groovy index 050fd99..9f2310f 100644 --- a/functional-test/src/test/groovy/functional/LargeInventorySpec.groovy +++ b/functional-test/src/test/groovy/functional/InventoryListSpec.groovy @@ -4,7 +4,7 @@ import functional.base.BaseTestConfiguration import org.testcontainers.spock.Testcontainers @Testcontainers -class LargeInventorySpec extends BaseTestConfiguration { +class InventoryListSpec extends BaseTestConfiguration { static String PROJ_NAME = 'ansible-large-inventory' @@ -16,11 +16,11 @@ class LargeInventorySpec extends BaseTestConfiguration { def "test large inventory"(){ when: - def result = client.apiCall {api-> api.listNodes(PROJ_NAME,".*")} + def result = client.apiCall {api-> api.listNodes(PROJ_NAME,"tags:test")} then: result!=null - result.size()==8001 + result.size()==8000 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" @@ -30,4 +30,18 @@ class LargeInventorySpec extends BaseTestConfiguration { result.get("Node-7999").getAttributes().get("ansible_ssh_user") == "rundeck" 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 + result.get("node1").getAttributes().get("ansible_host") == "node1" + result.get("node1").getAttributes().get("ansible_user") == "agent" + result.get("node1").getAttributes().get("ansible_port") == "22" + } } diff --git a/functional-test/src/test/resources/docker/docker-compose.yml b/functional-test/src/test/resources/docker/docker-compose.yml index e5ad23a..9733514 100644 --- a/functional-test/src/test/resources/docker/docker-compose.yml +++ b/functional-test/src/test/resources/docker/docker-compose.yml @@ -33,7 +33,7 @@ services: - "4440" volumes: - ./ansible:/home/rundeck/ansible:rw - - ./ansible/ansible.cfg:/etc/ansible/ansible.cfg:rw + - ./ansible-list:/home/rundeck/ansible-list:rw volumes: rundeck-data: diff --git a/functional-test/src/test/resources/project-import/ansible-large-inventory/rundeck-ansible-large-inventory/files/etc/project.properties b/functional-test/src/test/resources/project-import/ansible-large-inventory/rundeck-ansible-large-inventory/files/etc/project.properties index 7a5958b..a7bb380 100644 --- a/functional-test/src/test/resources/project-import/ansible-large-inventory/rundeck-ansible-large-inventory/files/etc/project.properties +++ b/functional-test/src/test/resources/project-import/ansible-large-inventory/rundeck-ansible-large-inventory/files/etc/project.properties @@ -27,5 +27,9 @@ 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 +resources.source.3.config.ansible-config-file-path=/home/rundeck/ansible-list +resources.source.3.config.ansible-gather-facts=false +resources.source.3.config.ansible-ignore-errors=true +resources.source.3.type=com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory service.FileCopier.default.provider=sshj-scp service.NodeExecutor.default.provider=sshj-ssh \ No newline at end of file