summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authoromnom62 <75066712+omnom62@users.noreply.github.com>2026-09-26 07:47:54 +1000
committerGitHub <noreply@github.com>2026-09-26 07:47:54 +1000
commit51e6ddb410d0ec7cd0845cf8bb382c9d0d0144eb (patch)
tree2a4b8bf59c8d852e263d74a328e2f84a6dad379f /tests/integration
parent9fe93349225eb9b014e7a3e397da88fece40a0b2 (diff)
parent7b4c77e8ee650314c8913e0565ffb93194007284 (diff)
downloadrest.vyos-51e6ddb410d0ec7cd0845cf8bb382c9d0d0144eb.tar.gz
rest.vyos-51e6ddb410d0ec7cd0845cf8bb382c9d0d0144eb.zip
Merge pull request #28 from vyos/T8989_vyos_hostname_SIT_fix
T8989: vyos_hostname rework
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/targets/vyos_hostname/tests/httpapi/deleted.yaml39
-rw-r--r--tests/integration/targets/vyos_hostname/tests/httpapi/overridden.yaml15
-rw-r--r--tests/integration/targets/vyos_hostname/tests/httpapi/rtt.yaml25
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