mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-09 14:50:02 -07:00
Meraki - Integration tests now clean up on failure (#42227)
* Added block and always support to meraki_network integration test * Add blocks to admin and vlan integration test * Resolved bad variable names
This commit is contained in:
parent
75c8d8bfc2
commit
f9cbdcd426
3 changed files with 723 additions and 724 deletions
|
@ -1,8 +1,9 @@
|
|||
# Test code for the Meraki Organization module
|
||||
# Test code for the Meraki Admin module
|
||||
# Copyright: (c) 2018, Kevin Breit (@kbreit)
|
||||
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- block:
|
||||
- name: Create new administrator
|
||||
meraki_admin:
|
||||
auth_key: '{{auth_key}}'
|
||||
|
@ -228,6 +229,10 @@
|
|||
- query_name.data.name == "Jane Doe"
|
||||
- 'query_email.data.email == "{{email_prefix}}+janedoe@{{email_domain}}"'
|
||||
|
||||
always:
|
||||
#############################################################################
|
||||
# Tear down starts here
|
||||
#############################################################################
|
||||
- name: Delete administrators
|
||||
meraki_admin:
|
||||
auth_key: '{{auth_key}}'
|
||||
|
@ -236,6 +241,7 @@
|
|||
email: '{{item}}'
|
||||
delegate_to: localhost
|
||||
register: delete_all
|
||||
ignore_errors: yes
|
||||
loop:
|
||||
- '{{email_prefix}}+janedoe@{{email_domain}}'
|
||||
- '{{email_prefix}}+johndoe@{{email_domain}}'
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- block:
|
||||
- name: Create network without type
|
||||
meraki_network:
|
||||
auth_key: '{{ auth_key }}'
|
||||
|
@ -180,9 +181,13 @@
|
|||
- name: Query assertions
|
||||
assert:
|
||||
that:
|
||||
# - net_query_all.data | length == 7
|
||||
- 'net_query_one.data.name == "IntTestNetworkSwitch"'
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Tear down starts here
|
||||
#############################################################################
|
||||
always:
|
||||
- name: Delete network without org
|
||||
meraki_network:
|
||||
auth_key: '{{ auth_key }}'
|
||||
|
@ -192,9 +197,6 @@
|
|||
register: delete_all_no_org
|
||||
ignore_errors: yes
|
||||
|
||||
- debug:
|
||||
msg: '{{delete_all_no_org}}'
|
||||
|
||||
- name: Delete network by org ID
|
||||
meraki_network:
|
||||
auth_key: '{{ auth_key }}'
|
||||
|
@ -204,9 +206,6 @@
|
|||
delegate_to: localhost
|
||||
register: delete_net_org_id
|
||||
|
||||
- debug:
|
||||
msg: '{{delete_net_org_id}}'
|
||||
|
||||
- name: Query after delete with org ID
|
||||
meraki_network:
|
||||
auth_key: '{{ auth_key }}'
|
||||
|
@ -223,6 +222,7 @@
|
|||
net_name: '{{ item }}'
|
||||
delegate_to: localhost
|
||||
register: delete_all
|
||||
ignore_errors: yes
|
||||
loop:
|
||||
- IntTestNetworkSwitch
|
||||
- IntTestNetworkWireless
|
||||
|
@ -231,17 +231,6 @@
|
|||
- IntTestNetworkTag
|
||||
- IntTestNetworkTags
|
||||
|
||||
- name: Query after delete all
|
||||
meraki_network:
|
||||
auth_key: '{{ auth_key }}'
|
||||
state: query
|
||||
org_name: '{{test_org_name}}'
|
||||
delegate_to: localhost
|
||||
register: query_deleted
|
||||
|
||||
- name: Delete assertions
|
||||
assert:
|
||||
- assert:
|
||||
that:
|
||||
- '"org_name or org_id parameters are required" in delete_all_no_org.msg'
|
||||
# - query_deleted_org_id.data | length == 6
|
||||
# - query_deleted.data | length == 0
|
||||
- 'delete_all_no_org.msg == "org_name or org_id parameters are required"'
|
|
@ -1,8 +1,9 @@
|
|||
# Test code for the Meraki Organization module
|
||||
# Test code for the Meraki VLAN module
|
||||
# Copyright: (c) 2018, Kevin Breit (@kbreit)
|
||||
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- block:
|
||||
- name: Test an API key is provided
|
||||
fail:
|
||||
msg: Please define an API key
|
||||
|
@ -13,7 +14,7 @@
|
|||
auth_key: '{{ auth_key }}'
|
||||
host: marrrraki.com
|
||||
state: present
|
||||
org_name: '{{test_org_name}}'
|
||||
org_name: IntTestOrg
|
||||
output_level: debug
|
||||
delegate_to: localhost
|
||||
register: invalid_domain
|
||||
|
@ -24,7 +25,6 @@
|
|||
auth_key: '{{ auth_key }}'
|
||||
use_https: false
|
||||
state: query
|
||||
org_name: '{{test_org_name}}'
|
||||
output_level: debug
|
||||
delegate_to: localhost
|
||||
register: http
|
||||
|
@ -160,7 +160,7 @@
|
|||
that:
|
||||
- update_vlan_add_ip.changed == True
|
||||
- update_vlan_add_ip.data.fixedIpAssignments | length == 2
|
||||
- update_vlan_add_ip.data.reservedIpRanges | length == 2
|
||||
- update_vlan_add_ip.data.reservedIpRange | length == 2
|
||||
|
||||
- name: Remove IP assignments and reserved IP ranges
|
||||
meraki_vlan:
|
||||
|
@ -191,7 +191,7 @@
|
|||
that:
|
||||
- update_vlan_remove_ip.changed == True
|
||||
- update_vlan_remove_ip.data.fixedIpAssignments | length == 1
|
||||
- update_vlan_remove_ip.data.reservedIpRanges | length == 1
|
||||
- update_vlan_remove_ip.data.reservedIpRange | length == 1
|
||||
|
||||
- name: Update VLAN with idempotency
|
||||
meraki_vlan:
|
||||
|
@ -289,6 +289,10 @@
|
|||
- query_vlan.data.id == 2
|
||||
- query_vlan.changed == False
|
||||
|
||||
always:
|
||||
#############################################################################
|
||||
# Tear down starts here
|
||||
#############################################################################
|
||||
- name: Delete VLAN
|
||||
meraki_vlan:
|
||||
auth_key: '{{auth_key}}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue