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
cloud/vcenter
needs/target/prepare_vmware_tests
zuul/vmware/vcenter_only

View file

@ -2,91 +2,89 @@
# 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)
- when: vcsim is not defined
block:
- name: Create 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'
category_description: '{{ item }} description'
associable_object_types:
- "{{ item }}"
state: present
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: 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 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'
category_description: '{{ item }} description'
associable_object_types:
- "{{ item }}"
state: present
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
vmware_category:
hostname: '{{ vcenter_hostname }}'
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 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: Assert change is made
assert:
that:
- category_change.changed
- name: Create category with 2 associable object types
vmware_category:
hostname: '{{ vcenter_hostname }}'
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
vmware_category:
hostname: '{{ vcenter_hostname }}'
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
- name: Assert change is made
assert:
that:
- category_change.changed
- name: Delete category with 2 associable object types
vmware_category:
hostname: '{{ vcenter_hostname }}'
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>
# 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