Skip to content

Commit 377458c

Browse files
Added functional test
1 parent f99e9ab commit 377458c

File tree

6 files changed

+100
-0
lines changed

6 files changed

+100
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package functional
2+
3+
import functional.base.BaseTestConfiguration
4+
import org.testcontainers.spock.Testcontainers
5+
6+
@Testcontainers
7+
class MaxAliasesSpec extends BaseTestConfiguration {
8+
9+
static String PROJ_NAME = 'ansible-max-aliases'
10+
static String NODE_1 = 'proxy-1.example.net'
11+
static String NODE_2 = 'proxy-2.example.net'
12+
static String NODE_3 = 'proxy-3.example.net'
13+
14+
def setupSpec() {
15+
startCompose()
16+
configureRundeck(PROJ_NAME, NODE_1)
17+
}
18+
19+
void "max aliases"() {
20+
when:
21+
def result = client.apiCall {api-> api.listNodes(PROJ_NAME,'.*')}
22+
23+
then:
24+
result != null
25+
result.size() == 4
26+
result.get(NODE_1) != null
27+
result.get(NODE_1).getAttributes().get('nodename') == 'proxy-1.example.net'
28+
result.get(NODE_1).getAttributes().get('hostname') == 'proxy-1.example.net'
29+
result.get(NODE_1).getAttributes().get('tags') == 'fr, fr1'
30+
result.get(NODE_2) != null
31+
result.get(NODE_2).getAttributes().get('nodename') == 'proxy-2.example.net'
32+
result.get(NODE_2).getAttributes().get('hostname') == 'proxy-2.example.net'
33+
result.get(NODE_2).getAttributes().get('tags') == 'fr, fr1'
34+
result.get(NODE_3) != null
35+
result.get(NODE_3).getAttributes().get('nodename') == 'proxy-3.example.net'
36+
result.get(NODE_3).getAttributes().get('hostname') == 'proxy-3.example.net'
37+
result.get(NODE_3).getAttributes().get('tags') == 'fr2'
38+
}
39+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[defaults]
2+
inventory=/home/rundeck/ansible-max-aliases/inventory_max_aliases.ini
3+
interpreter_python=/usr/bin/python3
4+
5+
6+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[fr:children]
2+
fr1
3+
fr2
4+
5+
[fr:vars]
6+
api_dcs=["fr1","fr2"]
7+
alias_01=["data-01","data-02"]
8+
9+
[fr1]
10+
proxy-1.example.net name=proxy-1 peers_ip=10.3.13.221 mgmt_ip=10.3.16.221 is_mon_master=True
11+
proxy-2.example.net name=proxy-2 peers_ip=10.3.13.222 mgmt_ip=10.3.16.222 is_mon_master=True
12+
13+
[fr2]
14+
proxy-3.example.net name=proxy-3 peers_ip=10.3.13.223 mgmt_ip=10.3.16.223 is_mon_master=True

functional-test/src/test/resources/docker/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ services:
3636
- ./ansible-list:/home/rundeck/ansible-list:rw
3737
- ./ansible-yaml-parsing:/home/rundeck/ansible-yaml-parsing:rw
3838
- ./ansible-child-groups:/home/rundeck/ansible-child-groups:rw
39+
- ./ansible-max-aliases:/home/rundeck/ansible-max-aliases:rw
3940

4041
volumes:
4142
rundeck-data:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
by:
2+
urn: project:ansible-yaml-parsing
3+
for:
4+
storage:
5+
- match:
6+
path: 'keys/.*'
7+
allow: [read]
8+
description: Allow access to key storage
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#edit below
2+
project.disable.executions=false
3+
project.disable.schedule=false
4+
project.execution.history.cleanup.batch=500
5+
project.execution.history.cleanup.enabled=false
6+
project.execution.history.cleanup.retention.days=60
7+
project.execution.history.cleanup.retention.minimum=50
8+
project.execution.history.cleanup.schedule=0 0 0 1/1 * ? *
9+
project.jobs.gui.groupExpandLevel=1
10+
project.later.executions.disable.value=0
11+
project.later.executions.disable=false
12+
project.later.executions.enable.value=
13+
project.later.executions.enable=false
14+
project.later.schedule.disable.value=
15+
project.later.schedule.disable=false
16+
project.later.schedule.enable.value=
17+
project.later.schedule.enable=false
18+
project.name=ansible-max-aliases
19+
project.nodeCache.enabled=false
20+
project.nodeCache.firstLoadSynch=true
21+
project.output.allowUnsanitized=false
22+
project.retry-counter=3
23+
project.ssh-authentication=privateKey
24+
resources.source.1.type=local
25+
resources.source.2.config.ansible-config-file-path=/home/rundeck/ansible-max-aliases/ansible.cfg
26+
resources.source.2.config.ansible-gather-facts=false
27+
resources.source.2.config.ansible-ignore-errors=true
28+
resources.source.2.config.ansible-inventory=/home/rundeck/ansible-max-aliases/inventory_max_aliases.ini
29+
resources.source.2.config.ansible-yaml-max-aliases=4
30+
resources.source.2.type=com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory
31+
service.FileCopier.default.provider=sshj-scp
32+
service.NodeExecutor.default.provider=sshj-ssh

0 commit comments

Comments
 (0)