summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authoromnom62 <75066712+omnom62@users.noreply.github.com>2026-08-27 22:51:05 +1000
committerGitHub <noreply@github.com>2026-08-27 15:51:05 +0300
commit4feeb7afe15182788c99392b2b401a6867eada88 (patch)
tree51fe13c14132fce77be9ee32d87046f2c97a5b9a /tests/integration
parentff5224728484eb4f3bbf6ae52fe0b79f64959660 (diff)
downloadrest.vyos-4feeb7afe15182788c99392b2b401a6867eada88.tar.gz
rest.vyos-4feeb7afe15182788c99392b2b401a6867eada88.zip
T8989: vyos_banner SIT fix (#27)
* T8989: vyos_banner SIT fix * T8989: vyos_banner SIT fix
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml5
-rw-r--r--tests/integration/targets/vyos_banner/tests/httpapi/gathered.yaml22
-rw-r--r--tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml31
-rw-r--r--tests/integration/targets/vyos_banner/tests/httpapi/overridden.yaml30
-rw-r--r--tests/integration/targets/vyos_banner/tests/httpapi/rtt.yaml24
5 files changed, 51 insertions, 61 deletions
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml
index 61f3f2d..9e4495c 100644
--- a/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml
+++ b/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml
@@ -3,9 +3,9 @@
msg: START vyos_banner deleted integration tests on connection={{ ansible_connection }}
- include_tasks: _remove_config.yaml
-- block:
- - include_tasks: _populate_config.yaml
+- include_tasks: _populate_config.yaml
+- block:
- name: Delete pre-login banner
register: result
vyos.rest.vyos_banner: &id001
@@ -25,6 +25,7 @@
assert:
that:
- result.changed == false
+ - result.commands == []
always:
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/gathered.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/gathered.yaml
index a332563..6cfa165 100644
--- a/tests/integration/targets/vyos_banner/tests/httpapi/gathered.yaml
+++ b/tests/integration/targets/vyos_banner/tests/httpapi/gathered.yaml
@@ -3,10 +3,10 @@
msg: START vyos_banner gathered integration tests on connection={{ ansible_connection }}
- include_tasks: _remove_config.yaml
-- block:
- - include_tasks: _populate_config.yaml
+- include_tasks: _populate_config.yaml
- - name: Gather banner configuration
+- block:
+ - name: Gather all banners (no config specified)
register: result
vyos.rest.vyos_banner:
state: gathered
@@ -15,6 +15,22 @@
that:
- result.changed == false
- result.gathered is defined
+ - "'pre-login' in result.gathered"
+ - "'post-login' in result.gathered"
+ - result.gathered['pre-login'].text == "Ansible test pre-login banner"
+ - result.gathered['post-login'].text == "Ansible test post-login banner"
+
+ - name: Gather specific pre-login banner
+ register: result
+ vyos.rest.vyos_banner:
+ config:
+ banner: pre-login
+ state: gathered
+
+ - assert:
+ that:
+ - result.changed == false
+ - result.gathered.text == "Ansible test pre-login banner"
always:
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml
index 85fafdb..5d7033f 100644
--- a/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml
+++ b/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml
@@ -1,34 +1,31 @@
---
- debug:
- msg: START vyos_banner gathered integration tests on connection={{ ansible_connection }}
+ msg: START vyos_banner merged integration tests on connection={{ ansible_connection }}
- include_tasks: _remove_config.yaml
-- block:
- - include_tasks: _populate_config.yaml
- - name: Gather all banners (no config specified)
+- block:
+ - name: Merge pre-login banner configuration
register: result
- vyos.rest.vyos_banner:
- state: gathered
+ vyos.rest.vyos_banner: &id001
+ config:
+ banner: pre-login
+ text: "Ansible merged pre-login banner"
+ state: merged
- assert:
that:
- - result.changed == false
- - result.gathered is defined
- - "'pre-login' in result.gathered"
- - "'post-login' in result.gathered"
+ - result.changed == true
- - name: Gather specific pre-login banner
+ - name: Merge pre-login banner configuration (IDEMPOTENT)
register: result
- vyos.rest.vyos_banner:
- config:
- banner: pre-login
- state: gathered
+ vyos.rest.vyos_banner: *id001
- - assert:
+ - name: Assert idempotent
+ assert:
that:
- result.changed == false
- - result.gathered.text == "Ansible test pre-login banner"
+ - result.commands == []
always:
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/overridden.yaml
deleted file mode 100644
index f80add0..0000000
--- a/tests/integration/targets/vyos_banner/tests/httpapi/overridden.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-- debug:
- msg: START vyos_hostname overridden integration tests on connection={{ ansible_connection }}
-
-- include_tasks: _remove_config.yaml
-- include_tasks: _populate_config.yaml
-
-- block:
- - name: Override hostname configuration
- register: result
- vyos.rest.vyos_hostname: &id001
- config:
- hostname: ansible-overridden-host
- state: overridden
-
- - assert:
- that:
- - result.changed == true
-
- - name: Override hostname configuration (IDEMPOTENT)
- register: result
- vyos.rest.vyos_hostname: *id001
-
- - assert:
- that:
- - result.changed == false
- - result.commands == []
-
- always:
- - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/rtt.yaml
index 233f1ef..9afe442 100644
--- a/tests/integration/targets/vyos_banner/tests/httpapi/rtt.yaml
+++ b/tests/integration/targets/vyos_banner/tests/httpapi/rtt.yaml
@@ -1,41 +1,47 @@
---
- debug:
- msg: START vyos_hostname round trip integration tests on connection={{ ansible_connection }}
+ msg: START vyos_banner round trip integration tests on connection={{ ansible_connection }}
- include_tasks: _remove_config.yaml
- block:
- name: RTT - Apply base configuration
- vyos.rest.vyos_hostname:
+ vyos.rest.vyos_banner:
config:
- hostname: ansible-rtt-host
+ banner: pre-login
+ text: "RTT pre-login banner"
state: merged
- name: RTT - Gather configuration
register: gathered
- vyos.rest.vyos_hostname:
+ vyos.rest.vyos_banner:
+ config:
+ banner: pre-login
state: gathered
- name: RTT - Assert gathered matches applied
assert:
that:
- - gathered.gathered.hostname == "ansible-rtt-host"
+ - gathered.gathered.text == "RTT pre-login banner"
- name: RTT - Modify configuration
- vyos.rest.vyos_hostname:
+ vyos.rest.vyos_banner:
config:
- hostname: ansible-rtt-modified
+ banner: pre-login
+ text: "RTT modified pre-login banner"
state: replaced
- name: RTT - Gather modified configuration
register: gathered2
- vyos.rest.vyos_hostname:
+ vyos.rest.vyos_banner:
+ config:
+ banner: pre-login
state: gathered
- name: RTT - Assert modification applied correctly
assert:
that:
- - gathered2.gathered.hostname == "ansible-rtt-modified"
+ - gathered2.gathered.text == "RTT modified pre-login banner"
always:
- include_tasks: _remove_config.yaml