diff options
Diffstat (limited to 'tests/integration')
3 files changed, 54 insertions, 25 deletions
diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/deleted.yaml new file mode 100644 index 0000000..8ab278b --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/deleted.yaml @@ -0,0 +1,39 @@ +--- +- debug: + msg: START vyos_hostname deleted integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Delete hostname configuration + register: result + vyos.rest.vyos_hostname: &id001 + state: deleted + + - assert: + that: + - result.changed == true + + - name: Gather after delete + register: gathered + vyos.rest.vyos_hostname: + state: gathered + + - name: Assert hostname no longer the populated test value + assert: + that: + - gathered.gathered.hostname != "ansible-test-host" + + - name: Delete hostname configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_hostname: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/overridden.yaml index 671ac41..68c245c 100644 --- a/tests/integration/targets/vyos_hostname/tests/httpapi/overridden.yaml +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/overridden.yaml @@ -1,27 +1,24 @@ --- - debug: - msg: START vyos_interfaces overridden integration tests on connection={{ ansible_connection }} + msg: START vyos_hostname overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml -- include_tasks: _populate_config.yaml - block: - - name: Override interface configuration + - name: Override hostname configuration register: result - vyos.rest.vyos_interfaces: &id001 + vyos.rest.vyos_hostname: &id001 config: - - name: eth0 - description: Ansible overridden interface - mtu: 1400 + hostname: ansible-overridden-host state: overridden - assert: that: - result.changed == true - - name: Override interface configuration (IDEMPOTENT) + - name: Override hostname configuration (IDEMPOTENT) register: result - vyos.rest.vyos_interfaces: *id001 + vyos.rest.vyos_hostname: *id001 - assert: that: diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/rtt.yaml index 74261f8..233f1ef 100644 --- a/tests/integration/targets/vyos_hostname/tests/httpapi/rtt.yaml +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/rtt.yaml @@ -1,48 +1,41 @@ --- - debug: - msg: START vyos_interfaces round trip integration tests on connection={{ ansible_connection }} + msg: START vyos_hostname round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - name: RTT - Apply base configuration - vyos.rest.vyos_interfaces: + vyos.rest.vyos_hostname: config: - - name: eth0 - description: Ansible RTT interface - mtu: 1450 + hostname: ansible-rtt-host state: merged - name: RTT - Gather configuration register: gathered - vyos.rest.vyos_interfaces: + vyos.rest.vyos_hostname: state: gathered - name: RTT - Assert gathered matches applied assert: that: - - gathered.gathered | selectattr('name', 'eq', 'eth0') | list | length == 1 - - gathered.gathered | selectattr('name', 'eq', 'eth0') | map(attribute='description') | first == 'Ansible RTT interface' - - gathered.gathered | selectattr('name', 'eq', 'eth0') | map(attribute='mtu') | first == 1450 + - gathered.gathered.hostname == "ansible-rtt-host" - name: RTT - Modify configuration - vyos.rest.vyos_interfaces: + vyos.rest.vyos_hostname: config: - - name: eth0 - description: Ansible RTT modified - mtu: 1400 + hostname: ansible-rtt-modified state: replaced - name: RTT - Gather modified configuration register: gathered2 - vyos.rest.vyos_interfaces: + vyos.rest.vyos_hostname: state: gathered - name: RTT - Assert modification applied correctly assert: that: - - gathered2.gathered | selectattr('name', 'eq', 'eth0') | map(attribute='description') | first == 'Ansible RTT modified' - - gathered2.gathered | selectattr('name', 'eq', 'eth0') | map(attribute='mtu') | first == 1400 + - gathered2.gathered.hostname == "ansible-rtt-modified" always: - include_tasks: _remove_config.yaml |
