summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authoromnom62 <omnom62@outlook.com>2026-06-02 21:11:33 +1000
committeromnom62 <omnom62@outlook.com>2026-06-02 21:11:33 +1000
commit066ab3c5795cfc30337831708da1a73a449f404f (patch)
tree7050ba40f12ca00d2b196f7025907b7a74fc9020 /tests/integration
parente41f9f0f331c0175fa7f9676b9636131d2cc586a (diff)
downloadrest.vyos-066ab3c5795cfc30337831708da1a73a449f404f.tar.gz
rest.vyos-066ab3c5795cfc30337831708da1a73a449f404f.zip
Hostname module fixes
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/targets/vyos_banner/tests/httpapi/_populate_config.yaml17
-rw-r--r--tests/integration/targets/vyos_banner/tests/httpapi/_remove_config.yaml2
-rw-r--r--tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml6
-rw-r--r--tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml30
4 files changed, 31 insertions, 24 deletions
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/_populate_config.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/_populate_config.yaml
index 2557b70..7bd2698 100644
--- a/tests/integration/targets/vyos_banner/tests/httpapi/_populate_config.yaml
+++ b/tests/integration/targets/vyos_banner/tests/httpapi/_populate_config.yaml
@@ -1,11 +1,14 @@
---
-- name: Populate banner config for testing
+- name: Populate pre-login banner for testing
vyos.rest.vyos_banner:
config:
- banners:
- - banner: pre-login
- text: "Ansible test pre-login banner"
- - banner: post-login
- text: "Ansible test post-login banner"
+ banner: pre-login
+ text: "Ansible test pre-login banner"
+ state: merged
+
+- name: Populate post-login banner for testing
+ vyos.rest.vyos_banner:
+ config:
+ banner: post-login
+ text: "Ansible test post-login banner"
state: merged
- ignore_errors: true
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/_remove_config.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/_remove_config.yaml
index cc56d27..2b43847 100644
--- a/tests/integration/targets/vyos_banner/tests/httpapi/_remove_config.yaml
+++ b/tests/integration/targets/vyos_banner/tests/httpapi/_remove_config.yaml
@@ -1,5 +1,5 @@
---
-- name: Remove pre-existing banner config
+- name: Remove all banners
vyos.rest.vyos_banner:
state: deleted
ignore_errors: true
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml
index 5d0db34..82e0f6e 100644
--- a/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml
+++ b/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml
@@ -6,16 +6,18 @@
- include_tasks: _populate_config.yaml
- block:
- - name: Delete all banner configuration
+ - name: Delete pre-login banner
register: result
vyos.rest.vyos_banner: &id001
+ config:
+ banner: pre-login
state: deleted
- assert:
that:
- result.changed == true
- - name: Delete banner configuration (IDEMPOTENT)
+ - name: Delete pre-login banner (IDEMPOTENT)
register: result
vyos.rest.vyos_banner: *id001
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml
index 027702a..96a984e 100644
--- a/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml
+++ b/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml
@@ -1,32 +1,34 @@
---
- debug:
- msg: START vyos_banner merged integration tests on connection={{ ansible_connection }}
+ msg: START vyos_banner gathered integration tests on connection={{ ansible_connection }}
- include_tasks: _remove_config.yaml
+- include_tasks: _populate_config.yaml
- block:
- - name: Merge banner configuration
+ - name: Gather all banners (no config specified)
register: result
- vyos.rest.vyos_banner: &id001
- config:
- banners:
- - banner: pre-login
- text: "Ansible test pre-login banner"
- state: merged
+ vyos.rest.vyos_banner:
+ state: gathered
- assert:
that:
- - result.changed == true
+ - result.changed == false
+ - result.gathered is defined
+ - "'pre-login' in result.gathered"
+ - "'post-login' in result.gathered"
- - name: Merge banner configuration (IDEMPOTENT)
+ - name: Gather specific pre-login banner
register: result
- vyos.rest.vyos_banner: *id001
+ vyos.rest.vyos_banner:
+ config:
+ banner: pre-login
+ state: gathered
- - name: Assert idempotent
- assert:
+ - assert:
that:
- result.changed == false
- - result.commands == []
+ - result.gathered.text == "Ansible test pre-login banner"
always:
- include_tasks: _remove_config.yaml