summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/eos_l2_interface
diff options
context:
space:
mode:
authorNathaniel Case <ncase@redhat.com>2019-05-23 13:32:47 +0200
committerNilashish Chakraborty <nilashishchakraborty8@gmail.com>2019-05-23 13:32:46 +0200
commitcebb363fcc03a63535ff0aaf769d90bd8380fd25 (patch)
tree5eb979bffa1187bb738cc9c79462670814d48a48 /test/integration/targets/eos_l2_interface
parentVMware: vcenter_folder: print full path of the new folder (#55237) (diff)
downloadansible-cebb363fcc03a63535ff0aaf769d90bd8380fd25.tar.xz
ansible-cebb363fcc03a63535ff0aaf769d90bd8380fd25.zip
eos_l2_interface handle "Interface does not exist" (#56787)
* Quick and dirty attempt to handle eapi error * Well this should probably change * Hopefully this works correctly? * Fix check_rc handling with httpapi * Add tests that should hopefully cover the error * Fix warnings * Improve tests
Diffstat (limited to 'test/integration/targets/eos_l2_interface')
-rw-r--r--test/integration/targets/eos_l2_interface/tests/cli/no_interface.yaml36
-rw-r--r--test/integration/targets/eos_l2_interface/tests/eapi/no_interface.yaml37
2 files changed, 73 insertions, 0 deletions
diff --git a/test/integration/targets/eos_l2_interface/tests/cli/no_interface.yaml b/test/integration/targets/eos_l2_interface/tests/cli/no_interface.yaml
new file mode 100644
index 0000000000..59b402c75b
--- /dev/null
+++ b/test/integration/targets/eos_l2_interface/tests/cli/no_interface.yaml
@@ -0,0 +1,36 @@
+---
+- debug:
+ msg: "START eos_l3_interface/cli/no_interface.yaml on connection={{ ansible_connection }}"
+
+- name: Create fake interface
+ eos_interface:
+ name: Management0
+ become: yes
+
+- block:
+ - name: eos_l2_interface shouldn't fail
+ eos_l2_interface: &no_switchport
+ name: Ethernet1
+ state: absent
+ become: yes
+ register: result
+
+ - assert:
+ that: "'Interface does not exist' in result.warnings[0]"
+
+ always:
+ - name: Cleanup fake interface
+ cli_config:
+ config: no interface Management0
+ become: yes
+
+- name: eos_l2_interface should still not fail
+ eos_l2_interface: *no_switchport
+ become: yes
+ register: result
+
+- assert:
+ that: "result.warnings is not defined"
+
+- debug:
+ msg: "END eos_l3_interface/cli/no_interface.yaml on connection={{ ansible_connection }}"
diff --git a/test/integration/targets/eos_l2_interface/tests/eapi/no_interface.yaml b/test/integration/targets/eos_l2_interface/tests/eapi/no_interface.yaml
new file mode 100644
index 0000000000..5be724cbc1
--- /dev/null
+++ b/test/integration/targets/eos_l2_interface/tests/eapi/no_interface.yaml
@@ -0,0 +1,37 @@
+---
+- debug:
+ msg: "START eos_l3_interface/eapi/no_interface.yaml on connection={{ ansible_connection }}"
+
+- name: Create fake interface
+ eos_interface:
+ name: Management0
+ become: yes
+
+- block:
+ - name: eos_l2_interface shouldn't fail
+ eos_l2_interface: &no_switchport
+ name: Ethernet1
+ state: absent
+ become: yes
+ register: result
+
+ - assert:
+ that: "'Interface does not exist' in result.warnings[0]"
+
+ always:
+ - name: Cleanup fake interface
+ eos_config:
+ lines:
+ - no interface Management0
+ become: yes
+
+- name: eos_l2_interface should still not fail
+ eos_l2_interface: *no_switchport
+ become: yes
+ register: result
+
+- assert:
+ that: "result.warnings is not defined"
+
+- debug:
+ msg: "END eos_l3_interface/eapi/no_interface.yaml on connection={{ ansible_connection }}"