Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-bish committed Nov 19, 2023
1 parent abfb18a commit 75adcce
Show file tree
Hide file tree
Showing 31 changed files with 579 additions and 3 deletions.
18 changes: 18 additions & 0 deletions tests/integration/targets/ntnx_acps/tasks/delete_acp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@
fail_msg: " Unable to Create ACP all specfactions "
success_msg: " ACP with all specfactions created successfully "

- name: Delete acp with check mode
ntnx_acps:
state: absent
acp_uuid: "{{ result.response.metadata.uuid }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Acp with uuid:{{ result.response.metadata.uuid }} will be deleted."
- output.acp_uuid == "{{ result.response.metadata.uuid }}"
fail_msg: "Acp Policy been deleted successfully within check_mode"
success_msg: "Returned As expected"


- name: Delete acp
ntnx_acps:
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/targets/ntnx_address_groups/tasks/delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@
success_msg: "address group created susccessfully"

###################################################################################################
- name: Delete address group with check mode
ntnx_address_groups:
state: absent
address_group_uuid: "{{ test_ag.address_group_uuid }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Address group with uuid:{{ test_ag.address_group_uuid }} will be deleted."
- output.address_group_uuid == "{{ test_ag.address_group_uuid }}"
fail_msg: "Address group Policy been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: delete address group
ntnx_address_groups:
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/targets/ntnx_categories/tasks/all_operations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,24 @@
fail_msg: "Fail: unable to update existing category by deleting all values "
success_msg: "Passed: update existing category by deleting all values finished successfully"
#################
- name: Delete category with check mode
ntnx_categories:
state: absent
name: "{{ first_category.name }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Category with name:{{ first_category.name }} will be deleted."
- output.category_name == "{{ first_category.name }}"
fail_msg: "category been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: Delte the category
ntnx_categories:
state: "absent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,25 @@
fail_msg: " Fail : unable to upload image with nos installer_type "
success_msg: "Succes: upload image with nos installer_type successfully "

- name: Delete Image with nos installer_type with check mode
ntnx_foundation_image_upload:
state: absent
filename: "integration-test-ntnx-package.tar.gz"
installer_type: nos
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Image with name:integration-test-ntnx-package.tar.gz will be deleted."
- output.image_name == "integration-test-ntnx-package.tar.gz"
fail_msg: "Image with nos installer_type been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: Delete Image with nos installer_type
ntnx_foundation_image_upload:
state: absent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@
fail_msg: "Unable to create image placement policy with minimal spec"
success_msg: "Image placement policy with minimal spec created successfully"

- name: Delete image with check mode
ntnx_image_placement_policy:
state: absent
policy_uuid: "{{ result.response.metadata.uuid }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Placement policy with uuid:{{ result.response.metadata.uuid }} will be deleted."
- output.policy_uuid == "{{ result.response.metadata.uuid }}"
fail_msg: "Image Policy been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: Delete image placement policy created above
ntnx_image_placement_policy:
state: absent
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/targets/ntnx_images/tasks/delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@
fail_msg: "Unable to create image with minimal spec for delete tests"
success_msg: "Image with minimal spec created successfully"


- name: Delete image with check mode
ntnx_images:
state: absent
image_uuid: "{{ result.response.metadata.uuid }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Image with uuid:{{ result.response.metadata.uuid }} will be deleted."
- output.uuid == "{{ result.response.metadata.uuid }}"
fail_msg: "Image been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: Delete image created above
ntnx_images:
state: absent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,23 @@
fail_msg: " Fail: unable to create DEV cluster with Flannel network provider"
success_msg: " Pass: create DEV cluster with Flannel network provider successfully "
#############################
- name: Delete Cluster with check mode
ntnx_karbon_clusters:
state: absent
name: "{{ result.response.name }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Cluster with name:{{ result.response.name }} will be deleted."
fail_msg: "Cluster been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: delete dev cluster with Flannel network provider
ntnx_karbon_clusters:
state: absent
Expand All @@ -163,7 +180,7 @@
- result.response.status == "SUCCEEDED"
fail_msg: " Fail: unable to delete dev cluster with Flannel network provider"
success_msg: " Pass: delete dev cluster with Flannel network provider finished successfully"
#############################
############################
- name: create DEV cluster with Calico network provider
ntnx_karbon_clusters:
cluster:
Expand Down Expand Up @@ -442,6 +459,26 @@
fail_msg: "Fail: Unable to update pool by decreasing cpu,memory_gb,num_instances and add remove labels "
success_msg: "Passed: update pool by decreasing cpu,memory_gb,num_instances and add remove labels finished successfully "
################################
- name: Delete pool with check mode
ntnx_karbon_clusters_node_pools:
state: absent
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Pool with name:{{ node1_name }} will be deleted."
- output.cluster_name == "{{karbon_name}}"
- output.node_pool_name == "{{node1_name}}"
fail_msg: "pool been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: delete pool
ntnx_karbon_clusters_node_pools:
state: absent
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/targets/ntnx_karbon_registries/tasks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,23 @@
fail_msg: "Fail: unable to create registry with username and password"
success_msg: "Pass: create registry with username and password finished successfully"
###############################################################
- name: Delete registry with check mode
ntnx_karbon_registries:
state: absent
name: "{{ registry_name }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Registry with name:{{ registry_name }} will be deleted."
fail_msg: "registry been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: delete registry
ntnx_karbon_registries:
name: "{{registry_name}}"
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/targets/ntnx_ndb_clusters/tasks/CRUD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,23 @@
success_msg: "module errored out correctly when incorrect name is given"

################################################################
- name: Delete Cluster with check mode
ntnx_ndb_clusters:
state: absent
uuid: "{{ todelete }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Cluster with uuid:{{ todelete }} will be deleted."
- output.cluster_uuid == "{{ todelete }}"
fail_msg: "Cluster been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: delete cluster
ntnx_ndb_clusters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,24 @@
fail_msg: "creation of spec for unregistration failed"
success_msg: "spec for unregistration created successfully"

- name: Delete clone db with check mode
ntnx_ndb_database_clones:
state: absent
uuid: "{{clone_uuid}}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Db clone with uuid:{{ clone_uuid }} will be deleted."
- output.uuid == "{{ clone_uuid }}"
fail_msg: "clone db been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: delete clone db
ntnx_ndb_database_clones:
state: "absent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,26 @@
success_msg: "databases added to database instance successfully"


- name: remove databases in database instance with check mode
ntnx_ndb_linked_databases:
state: absent
db_instance_uuid: "{{db_uuid}}"
database_uuid: "{{linked_databases.test1}}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Database with uuid:{{ db_uuid }} will be removed."
- output.db_uuid == "{{ db_uuid }}"
- output.db_instance_uuid == "{{ linked_databases.test1 }}"
fail_msg: " Remove databases in database instance within check_mode"
success_msg: "Returned As expected"

- name: remove databases in database instance
ntnx_ndb_linked_databases:
state: "absent"
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/targets/ntnx_ndb_db_server_vms/tasks/crud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,23 @@
db_server_uuid: "{{result.uuid}}"

################################### DB server VM Delete test #############################
- name: Delete db server vm with check mode
ntnx_ndb_db_server_vms:
state: absent
uuid: "{{ db_server_uuid }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Db server with uuid:{{ db_server_uuid }} will be deleted."
- output.uuid == "{{ db_server_uuid }}"
fail_msg: "db server vm been deleted successfully within check_mode"
success_msg: "Returned As expected"


- name: unregister db server vm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,23 @@


############################################## delete tests ####################################
- name: Delete window with check mode
ntnx_ndb_maintenance_window:
state: absent
uuid: "{{ window1_uuid }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Window with uuid:{{ window1_uuid }} will be deleted."
- output.uuid == "{{ window1_uuid }}"
fail_msg: "window been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: delete window 1
ntnx_ndb_maintenance_window:
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/targets/ntnx_ndb_profiles/tasks/compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@
fail_msg: "Fail: unable to verify unpublish flow in compute profile "
success_msg: "Pass: verify unpublish flow in compute profile finished successfully"
################################################################
- name: Delete profiles with check mode
ntnx_ndb_profiles:
state: absent
profile_uuid: "{{ todelete[0] }}"
register: output
ignore_errors: true
check_mode: true

- name: Creation Status
assert:
that:
- output.failed == false
- output.changed == false
- output.msg =="Profile with uuid:{{ todelete[0] }} will be deleted."
- output.uuid == "{{ todelete[0] }}"
fail_msg: "Profile been deleted successfully within check_mode"
success_msg: "Returned As expected"

- name: Delete all created cmpute profiles
ntnx_ndb_profiles:
state: absent
Expand Down
Loading

0 comments on commit 75adcce

Please sign in to comment.