vmware_category/test: ensure test can run on Zuul

- set the zuul/vmware/vcenter_only alias
- import `prepare_vmware_tests` role
- little refactoring to avoid an extra level of indentation
This commit is contained in:
Gonéri Le Bouder 2020-01-10 13:33:07 -05:00
parent 0703590686
commit ce66743b10
3 changed files with 88 additions and 85 deletions

View file

@ -1,3 +1,4 @@
shippable/vcenter/group1 shippable/vcenter/group1
cloud/vcenter cloud/vcenter
needs/target/prepare_vmware_tests needs/target/prepare_vmware_tests
zuul/vmware/vcenter_only

View file

@ -2,91 +2,89 @@
# Copyright: (c) 2019, Abhijeet Kasurde <akasurde@redhat.com> # Copyright: (c) 2019, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- when: vcsim is not defined - name: Create different types of category with associable object types
block: vmware_category:
- name: Create different types of category with associable object types hostname: '{{ vcenter_hostname }}'
vmware_category: username: '{{ vcenter_username }}'
hostname: '{{ vcenter_hostname }}' password: '{{ vcenter_password }}'
username: '{{ vcenter_username }}' validate_certs: False
password: '{{ vcenter_password }}' category_name: '{{ item }} name'
validate_certs: False category_description: '{{ item }} description'
category_name: '{{ item }} name' associable_object_types:
category_description: '{{ item }} description' - "{{ item }}"
associable_object_types: state: present
- "{{ item }}" with_items:
state: present - All objects
with_items: - Folder
- All objects - Cluster
- Folder - Datacenter
- Cluster - Datastore
- Datacenter - Datastore Cluster
- Datastore - Distributed Port Group
- Datastore Cluster - Distributed Switch
- Distributed Port Group - Host
- Distributed Switch - Content Library
- Host - Library item
- Content Library - Network
- Library item - Resource Pool
- Network - vApp
- Resource Pool - Virtual Machine
- vApp
- Virtual Machine
- name: Delete different types of category with associable object types
vmware_category:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: False
category_name: '{{ item }} name'
state: absent
with_items:
- All objects
- Folder
- Cluster
- Datacenter
- Datastore
- Datastore Cluster
- Distributed Port Group
- Distributed Switch
- Host
- Content Library
- Library item
- Network
- Resource Pool
- vApp
- Virtual Machine
- name: Create category with 2 associable object types - name: Delete different types of category with associable object types
vmware_category: vmware_category:
hostname: '{{ vcenter_hostname }}' hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}' username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
validate_certs: False validate_certs: False
category_name: 'Sample_cate_0001' category_name: '{{ item }} name'
category_description: 'sample description' state: absent
associable_object_types: with_items:
- Datastore - All objects
- Cluster - Folder
state: present - Cluster
register: category_change - Datacenter
- Datastore
- Datastore Cluster
- Distributed Port Group
- Distributed Switch
- Host
- Content Library
- Library item
- Network
- Resource Pool
- vApp
- Virtual Machine
- name: Assert change is made - name: Create category with 2 associable object types
assert: vmware_category:
that: hostname: '{{ vcenter_hostname }}'
- category_change.changed username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: False
category_name: 'Sample_cate_0001'
category_description: 'sample description'
associable_object_types:
- Datastore
- Cluster
state: present
register: category_change
- name: Delete category with 2 associable object types - name: Assert change is made
vmware_category: assert:
hostname: '{{ vcenter_hostname }}' that:
username: '{{ vcenter_username }}' - category_change.changed
password: '{{ vcenter_password }}'
validate_certs: False
category_name: 'Sample_cate_0001'
state: absent
register: category_change
- name: Assert change is made - name: Delete category with 2 associable object types
assert: vmware_category:
that: hostname: '{{ vcenter_hostname }}'
- category_change.changed username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: False
category_name: 'Sample_cate_0001'
state: absent
register: category_change
- name: Assert change is made
assert:
that:
- category_change.changed

View file

@ -2,4 +2,8 @@
# Copyright: (c) 2019, Abhijeet Kasurde <akasurde@redhat.com> # Copyright: (c) 2019, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- include: associable_obj_types.yml - when: vcsim is not defined
block:
- import_role:
name: prepare_vmware_tests
- include: associable_obj_types.yml