Skip to content

Commit

Permalink
vmware_vswitch/test: clean up vmswitch_0002
Browse files Browse the repository at this point in the history
Ensure `vmswitch_0002` get removed from ESXi2 at the end of the test.
  • Loading branch information
goneri committed Jan 29, 2020
1 parent e64b279 commit 6e2fff1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
13 changes: 3 additions & 10 deletions test/integration/targets/vmware_vswitch/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@

# TODO: akasurde: VCSIM does not suport network manager system
- name: Ensure the vswitch is not already here
vmware_vswitch:
validate_certs: no
hostname: '{{ item.host }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
switch: '{{ item.switch }}'
state: absent
with_items:
- {host: "{{ esxi1 }}", switch: "vmswitch_0001"}
- {host: "{{ esxi2 }}", switch: "vmswitch_0002"}
include_tasks: teardown.yml

- name: Add a nic to a switch
vmware_vswitch:
Expand Down Expand Up @@ -91,3 +82,5 @@
- assert:
that:
- add_vswitch_with_host_system is changed
always:
- include_tasks: teardown.yml
16 changes: 16 additions & 0 deletions test/integration/targets/vmware_vswitch/tasks/teardown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- name: Remove the vSwitches (ESXi1)
vmware_vswitch:
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
switch_name: vmswitch_0001
state: absent

- name: Remove the vSwitches (ESXi2)
vmware_vswitch:
hostname: '{{ esxi2 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
switch_name: vmswitch_0002
state: absent
when: esxi2 is defined

0 comments on commit 6e2fff1

Please sign in to comment.