Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-bish committed Oct 12, 2023
1 parent 58e24c6 commit ccf0ac3
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/integration/targets/nutanix_vms/tasks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,41 @@
fail_msg: 'Unable to Create VM with none values '
success_msg: 'VM with none values created successfully '

- set_fact:
todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
# ##################################################################################
- name: VM with owner name
ntnx_vms:
state: present
name: none
timezone: GMT
project:
uuid: "{{ project.uuid }}"
cluster:
name: "{{ cluster.name }}"
categories:
AppType:
- Apache_Spark
owner:
name: "{{ vm_owner.name }}"
disks:
- type: DISK
size_gb: 5
bus: SCSI
register: result
ignore_errors: true

- name: Creation Status
assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.response.metadata.owner_reference.name == "{{ vm_owner.name }}"
- result.response.metadata.owner_reference.uuid == "{{ vm_owner.uuid }}"
- result.response.metadata.owner_reference.kind == "user"
fail_msg: 'Unable to Create VM with owner'
success_msg: 'VM with owner created successfully '

- set_fact:
todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
##################################################################################
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/targets/nutanix_vms/tasks/vm_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@
fail_msg: ' Unable to create VM with minimum requiremnts '
success_msg: ' VM with minimum requiremnts created successfully '
####################################################################
- name: update vm by set owner by uuid
ntnx_vms:
vm_uuid: "{{ result.vm_uuid }}"
owner:
uuid: "{{vm_owner.uuid}}"
register: result
ignore_errors: true

- name: Update Status
assert:
that:
- result.response is defined
- result.vm_uuid
- result.task_uuid
- result.response.status.state == "COMPLETE"
- result.response.metadata.owner_reference.name == "{{ vm_owner.name }}"
- result.response.metadata.owner_reference.uuid == "{{ vm_owner.uuid }}"
- result.response.metadata.owner_reference.kind == "user"
fail_msg: ' Unable to update vm by setting owner '
success_msg: ' VM updated successfully by setting owner '
####################################################################

- debug:
msg: Start update tests for memory vcpus cores_per_vcpu

Expand Down

0 comments on commit ccf0ac3

Please sign in to comment.