|
| 1 | +# Each case is followed by mitogen_via= case to test hostvars pass. |
| 2 | + |
| 3 | + |
| 4 | +# No port set |
| 5 | +- name: integration/transport_config/port.yml |
| 6 | + hosts: tc-port-unset |
| 7 | + tasks: |
| 8 | + - include: ../_mitogen_only.yml |
| 9 | + - {mitogen_get_stack: {}, register: out} |
| 10 | + - assert: |
| 11 | + that: |
| 12 | + - out.result|length == 1 |
| 13 | + - out.result[0].method == "ssh" |
| 14 | + - out.result[0].kwargs.port == None |
| 15 | + |
| 16 | +# Not set, mitogen_via= |
| 17 | +- hosts: tc-port-explicit-ssh |
| 18 | + vars: {mitogen_via: tc-port-unset} |
| 19 | + tasks: |
| 20 | + - include: ../_mitogen_only.yml |
| 21 | + - {mitogen_get_stack: {}, register: out} |
| 22 | + - assert: |
| 23 | + that: |
| 24 | + - out.result|length == 2 |
| 25 | + - out.result[0].method == "ssh" |
| 26 | + - out.result[0].kwargs.port == None |
| 27 | + - out.result[1].method == "ssh" |
| 28 | + - out.result[1].kwargs.port == 4321 |
| 29 | + |
| 30 | +# ansible_ssh_port= |
| 31 | +- hosts: tc-port-explicit-ssh |
| 32 | + tasks: |
| 33 | + - include: ../_mitogen_only.yml |
| 34 | + - {mitogen_get_stack: {}, register: out} |
| 35 | + - assert: |
| 36 | + that: |
| 37 | + - out.result|length == 1 |
| 38 | + - out.result[0].method == "ssh" |
| 39 | + - out.result[0].kwargs.port == 4321 |
| 40 | + |
| 41 | +- hosts: tc-port-explicit-unset |
| 42 | + vars: {mitogen_via: tc-port-explicit-ssh} |
| 43 | + tasks: |
| 44 | + - include: ../_mitogen_only.yml |
| 45 | + - {mitogen_get_stack: {}, register: out} |
| 46 | + - assert: |
| 47 | + that: |
| 48 | + - out.result|length == 2 |
| 49 | + - out.result[0].method == "ssh" |
| 50 | + - out.result[1].kwargs.port == 4321 |
| 51 | + - out.result[1].method == "ssh" |
| 52 | + - out.result[0].kwargs.port == None |
| 53 | + |
| 54 | +# ansible_port= |
| 55 | +- hosts: tc-port-explicit-port |
| 56 | + tasks: |
| 57 | + - include: ../_mitogen_only.yml |
| 58 | + - {mitogen_get_stack: {}, register: out} |
| 59 | + - assert: |
| 60 | + that: |
| 61 | + - out.result|length == 1 |
| 62 | + - out.result[0].method == "ssh" |
| 63 | + - out.result[0].kwargs.port == 1234 |
| 64 | + |
| 65 | +- hosts: tc-port-unset |
| 66 | + vars: {mitogen_via: tc-port-explicit-port} |
| 67 | + tasks: |
| 68 | + - include: ../_mitogen_only.yml |
| 69 | + - {mitogen_get_stack: {}, register: out} |
| 70 | + - assert: |
| 71 | + that: |
| 72 | + - out.result|length == 2 |
| 73 | + - out.result[0].method == "ssh" |
| 74 | + - out.result[0].kwargs.port == 1234 |
| 75 | + - out.result[1].method == "ssh" |
| 76 | + - out.result[1].kwargs.port == None |
| 77 | + |
| 78 | + |
| 79 | +# both, ssh takes precedence |
| 80 | +- hosts: tc-port-both |
| 81 | + tasks: |
| 82 | + - include: ../_mitogen_only.yml |
| 83 | + - {mitogen_get_stack: {}, register: out} |
| 84 | + - assert: |
| 85 | + that: |
| 86 | + - out.result|length == 1 |
| 87 | + - out.result[0].method == "ssh" |
| 88 | + - out.result[0].kwargs.port == 1532 |
| 89 | + |
| 90 | +- hosts: tc-port-unset |
| 91 | + vars: {mitogen_via: tc-port-both} |
| 92 | + tasks: |
| 93 | + - include: ../_mitogen_only.yml |
| 94 | + - {mitogen_get_stack: {}, register: out} |
| 95 | + - assert: |
| 96 | + that: |
| 97 | + - out.result|length == 2 |
| 98 | + - out.result[0].method == "ssh" |
| 99 | + - out.result[0].kwargs.port == 1532 |
| 100 | + - out.result[1].method == "ssh" |
| 101 | + - out.result[1].kwargs.port == None |
0 commit comments