From ccf0ac32fb04fa2219c3b817a72a66a4fa71862c Mon Sep 17 00:00:00 2001 From: Alaa Bishtawi Date: Thu, 12 Oct 2023 14:26:29 +0300 Subject: [PATCH] add test --- .../targets/nutanix_vms/tasks/create.yml | 35 +++++++++++++++++++ .../targets/nutanix_vms/tasks/vm_update.yml | 22 ++++++++++++ 2 files changed, 57 insertions(+) diff --git a/tests/integration/targets/nutanix_vms/tasks/create.yml b/tests/integration/targets/nutanix_vms/tasks/create.yml index f8f43736a..afe4c5d7c 100644 --- a/tests/integration/targets/nutanix_vms/tasks/create.yml +++ b/tests/integration/targets/nutanix_vms/tasks/create.yml @@ -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"] ] }}' ################################################################################## diff --git a/tests/integration/targets/nutanix_vms/tasks/vm_update.yml b/tests/integration/targets/nutanix_vms/tasks/vm_update.yml index d8ee4048f..8ce3b8bc7 100644 --- a/tests/integration/targets/nutanix_vms/tasks/vm_update.yml +++ b/tests/integration/targets/nutanix_vms/tasks/vm_update.yml @@ -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