diff options
Diffstat (limited to 'tests/integration/targets/vyos_facts')
6 files changed, 46 insertions, 14 deletions
diff --git a/tests/integration/targets/vyos_facts/tasks/httpapi.yaml b/tests/integration/targets/vyos_facts/tasks/httpapi.yaml index 4147e6d..0ed3e42 100644 --- a/tests/integration/targets/vyos_facts/tasks/httpapi.yaml +++ b/tests/integration/targets/vyos_facts/tasks/httpapi.yaml @@ -9,7 +9,7 @@ - name: Set test_items ansible.builtin.set_fact: - test_items: "{{ test_cases.files | map(attribute='path') | list }}" + test_items: "{{ test_cases.files | map(attribute='path') | list | sort }}" - name: Run test case (connection=httpapi) ansible.builtin.include_tasks: "{{ test_case_to_run }}" diff --git a/tests/integration/targets/vyos_facts/tests/httpapi/_populate_config.yaml b/tests/integration/targets/vyos_facts/tests/httpapi/_populate_config.yaml new file mode 100644 index 0000000..690c0c8 --- /dev/null +++ b/tests/integration/targets/vyos_facts/tests/httpapi/_populate_config.yaml @@ -0,0 +1,16 @@ +--- +- name: Configure logging for facts testing + vyos.rest.vyos_logging_global: + config: + global_params: + facilities: + - facility: all + severity: notice + state: merged + +- name: Configure NTP for facts testing + vyos.rest.vyos_ntp_global: + config: + servers: + - server: time1.vyos.net + state: merged diff --git a/tests/integration/targets/vyos_facts/tests/httpapi/_remove_config.yaml b/tests/integration/targets/vyos_facts/tests/httpapi/_remove_config.yaml new file mode 100644 index 0000000..fbc2e73 --- /dev/null +++ b/tests/integration/targets/vyos_facts/tests/httpapi/_remove_config.yaml @@ -0,0 +1,8 @@ +--- +- name: Remove logging config + vyos.rest.vyos_logging_global: + state: deleted + +- name: Remove NTP config + vyos.rest.vyos_ntp_global: + state: deleted diff --git a/tests/integration/targets/vyos_facts/tests/httpapi/all.yaml b/tests/integration/targets/vyos_facts/tests/httpapi/all.yaml index 419634f..4d6ad53 100644 --- a/tests/integration/targets/vyos_facts/tests/httpapi/all.yaml +++ b/tests/integration/targets/vyos_facts/tests/httpapi/all.yaml @@ -3,6 +3,8 @@ msg: START vyos_facts all integration tests on connection={{ ansible_connection }} - block: + - include_tasks: _populate_config.yaml + - name: Gather all facts vyos.rest.vyos_facts: gather_subset: all @@ -14,3 +16,6 @@ - ansible_facts.vyos_users is defined - ansible_facts.vyos_config is defined - ansible_facts.vyos_logging is defined + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_facts/tests/httpapi/default.yaml b/tests/integration/targets/vyos_facts/tests/httpapi/default.yaml index ff1caee..b5937be 100644 --- a/tests/integration/targets/vyos_facts/tests/httpapi/default.yaml +++ b/tests/integration/targets/vyos_facts/tests/httpapi/default.yaml @@ -5,9 +5,9 @@ - block: - name: Gather default facts vyos.rest.vyos_facts: + gather_subset: default - assert: that: - ansible_facts.vyos_hostname is defined - - ansible_facts.vyos_interfaces is defined - - ansible_facts.vyos_hostname | length > 0 + - ansible_facts.vyos_config is defined diff --git a/tests/integration/targets/vyos_facts/tests/httpapi/subsets.yaml b/tests/integration/targets/vyos_facts/tests/httpapi/subsets.yaml index eb4ca4f..5151b4a 100644 --- a/tests/integration/targets/vyos_facts/tests/httpapi/subsets.yaml +++ b/tests/integration/targets/vyos_facts/tests/httpapi/subsets.yaml @@ -3,31 +3,34 @@ msg: START vyos_facts subsets integration tests on connection={{ ansible_connection }} - block: - - name: Gather hostname only + - include_tasks: _populate_config.yaml + + - name: Gather logging subset vyos.rest.vyos_facts: gather_subset: - - hostname + - logging - assert: that: - - ansible_facts.vyos_hostname is defined + - ansible_facts.vyos_logging is defined - - name: Gather users + - name: Gather ntp subset vyos.rest.vyos_facts: gather_subset: - - users + - ntp - assert: that: - - ansible_facts.vyos_users is defined - - ansible_facts.vyos_users | selectattr('name', 'eq', 'vyos') | list | length == 1 + - ansible_facts.vyos_ntp is defined - - name: Gather config + - name: Gather interfaces subset vyos.rest.vyos_facts: gather_subset: - - config + - interfaces - assert: that: - - ansible_facts.vyos_config is defined - - ansible_facts.vyos_config.system is defined + - ansible_facts.vyos_interfaces is defined + + always: + - include_tasks: _remove_config.yaml |
