mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Migrate Network Tests into ansible/ansible (#18233)
* Docs Networking tests * Copy networking tests from test-network-modules * Networking transport settings - group_vars * Network playbooks * Debug should be off by default * Update nxos.yaml * Remove items from top level * Use dependencies, not pre-tasks * Remove trailing blank lines * Remove backup files * newlines
This commit is contained in:
31
test/integration/targets/eos_facts/tests/cli/all_facts.yaml
Normal file
31
test/integration/targets/eos_facts/tests/cli/all_facts.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
- debug: msg="START cli/all_facts.yaml"
|
||||
|
||||
|
||||
- name: test getting all facts
|
||||
eos_facts:
|
||||
provider: "{{ cli }}"
|
||||
gather_subset:
|
||||
- all
|
||||
register: result
|
||||
|
||||
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# _facts modules should never report a change
|
||||
- "result.changed == false"
|
||||
|
||||
# Correct subsets are present
|
||||
- "'config' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'hardware' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'default' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'interfaces' in result.ansible_facts.ansible_net_gather_subset"
|
||||
|
||||
# Items from those subsets are present
|
||||
- "result.ansible_facts.ansible_net_filesystems is defined"
|
||||
# Check that these facts not only are present, but are valid (positive integers)
|
||||
- "result.ansible_facts.ansible_net_memfree_mb > 1"
|
||||
- "result.ansible_facts.ansible_net_memtotal_mb > 1"
|
||||
|
||||
- debug: msg="END cli/all_facts.yaml"
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
- debug: msg="START cli/default_facts.yaml"
|
||||
|
||||
|
||||
- name: test getting default facts
|
||||
eos_facts:
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# _facts modules should never report a change
|
||||
- "result.changed == false"
|
||||
|
||||
# Correct subsets are present
|
||||
- "'hardware' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'default' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'interfaces' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "result.ansible_facts.ansible_net_filesystems is defined"
|
||||
# ... and not present
|
||||
- "'config' not in result.ansible_facts.ansible_net_gather_subset"
|
||||
|
||||
# Items from those subsets are present
|
||||
- "result.ansible_facts.ansible_net_filesystems is defined" #hw
|
||||
- "result.ansible_facts.ansible_net_memtotal_mb > 10" #hw
|
||||
- "result.ansible_facts.ansible_net_interfaces.Ethernet1.ipv4.masklen > 1" # interfaces
|
||||
|
||||
# ... and not present
|
||||
- "result.ansible_facts.ansible_net_config is not defined" # config
|
||||
|
||||
- debug: msg="END cli/default.yaml"
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
- debug: msg="START cli/invalid_subset.yaml"
|
||||
|
||||
|
||||
- name: test invalid subset (foobar)
|
||||
eos_facts:
|
||||
provider: "{{ cli }}"
|
||||
gather_subset:
|
||||
- "foobar"
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# Failures shouldn't return changes
|
||||
- "result.changed == false"
|
||||
# It's a failure
|
||||
- "result.failed == true"
|
||||
# Sensible Failure message
|
||||
- "'Subset must be one of' in result.msg"
|
||||
|
||||
###############
|
||||
# FIXME Future
|
||||
# We may in the future want to add a test for
|
||||
|
||||
- name: test subset specified multiple times
|
||||
eos_facts:
|
||||
provider: "{{ cli }}"
|
||||
gather_subset:
|
||||
- "!hardware"
|
||||
- "hardware"
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# Failures shouldn't return changes
|
||||
- "result.changed == false"
|
||||
# It's a failure
|
||||
- "result.failed == true"
|
||||
# Sensible Failure message
|
||||
#- "result.msg == 'Bad subset'"
|
||||
ignore_errors: true
|
||||
|
||||
|
||||
|
||||
- debug: msg="END cli/invalid_subset.yaml"
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- debug: msg="START cli/not_hardware_facts.yaml"
|
||||
|
||||
|
||||
- name: test not hardware
|
||||
eos_facts:
|
||||
provider: "{{ cli }}"
|
||||
gather_subset:
|
||||
- "!hardware"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# _facts modules should never report a change
|
||||
- "result.changed == false"
|
||||
|
||||
# Correct subsets are present
|
||||
- "'config' in result.ansible_facts.ansible_net_gather_subset"
|
||||
|
||||
- "'default' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'interfaces' in result.ansible_facts.ansible_net_gather_subset"
|
||||
# ... and not present
|
||||
- "'hardware' not in result.ansible_facts.ansible_net_gather_subset"
|
||||
|
||||
# Items from those subsets are present
|
||||
- "result.ansible_facts.ansible_net_interfaces.Ethernet1.ipv4.masklen > 1" # interfaces
|
||||
# ... and not present
|
||||
- "result.ansible_facts.ansible_net_filesystems is not defined"
|
||||
|
||||
- debug: msg="END cli/not_hardware_facts.yaml"
|
||||
Reference in New Issue
Block a user