Skip to content

Commit

Permalink
Enhance Acp Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-bish committed Nov 1, 2023
1 parent d60ffd1 commit 236af45
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
26 changes: 18 additions & 8 deletions tests/integration/targets/ntnx_acps/tasks/create_acps.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
---
- name: Generate random name
set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"

- set_fact:
acp1_name: "{{random_name[0]}}1"
acp2_name: "{{random_name[0]}}2"
acp3_name: "{{random_name[0]}}3"
acp4_name: "{{random_name[0]}}4"

- name: Create min ACP
ntnx_acps:
state: present
wait: True
name: MinACP2
name: "{{acp1_name}}"
role:
uuid: "{{ acp.role.uuid }}"
register: result
Expand All @@ -16,15 +26,15 @@
- result.response is defined
- result.changed == false
- result.failed == false
- result.response.spec.name == 'MinACP2'
- result.response.spec.name == "{{acp1_name}}"
fail_msg: " Unable to create Min ACP with check mode "
success_msg: " Min ACP with check mode passed"
##########################################################
# ##########################################################
- name: Create min ACP
ntnx_acps:
state: present
wait: true
name: MinACP2
name: "{{acp2_name}}"
role:
uuid: '{{ acp.role.uuid }}'
check_mode: false
Expand All @@ -36,7 +46,7 @@
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.response.spec.name == 'MinACP2'
- result.response.spec.name == "{{acp2_name}}"
fail_msg: " Unable to create Min ACP "
success_msg: " Min ACP created successfully "

Expand Down Expand Up @@ -71,7 +81,7 @@
- name: Create ACP with user ad user group reference
ntnx_acps:
state: present
name: acp_with_user_and_user_group_reference2
name: "{{acp3_name}}"
role:
uuid: "{{ acp.role.uuid }}"
user_uuids:
Expand All @@ -86,7 +96,7 @@
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.response.spec.name == 'acp_with_user_and_user_group_reference2'
- result.response.spec.name == "{{acp3_name}}"
- result.response.status.resources.role_reference.uuid == "{{ acp.role.uuid }}"
- result.response.status.resources.user_reference_list.0.uuid == "{{ acp.user_uuid }}"
- result.response.status.resources.user_group_reference_list.0.uuid == "{{ acp.user_group_uuid }}"
Expand All @@ -99,7 +109,7 @@
- name: Create ACP with all specfactions
ntnx_acps:
state: present
name: acp_with_all_specfactions1
name: "{{acp4_name}}"
role:
uuid: "{{ acp.role.uuid }}"
user_uuids:
Expand Down
9 changes: 8 additions & 1 deletion tests/integration/targets/ntnx_acps/tasks/delete_acp.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
---
- name: Generate random name
set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"

- set_fact:
acp1_name: "{{random_name[0]}}1"

- name: Create ACP with all specfactions
ntnx_acps:
state: present
name: acp_with_all_specfactions1
name: "{{acp1_name}}"
role:
uuid: "{{ acp.role.uuid }}"
user_uuids:
Expand Down

0 comments on commit 236af45

Please sign in to comment.