summaryrefslogtreecommitdiffstats
path: root/ansible_collections/purestorage/fusion/tests/integration
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:04:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:04:41 +0000
commit975f66f2eebe9dadba04f275774d4ab83f74cf25 (patch)
tree89bd26a93aaae6a25749145b7e4bca4a1e75b2be /ansible_collections/purestorage/fusion/tests/integration
parentInitial commit. (diff)
downloadansible-975f66f2eebe9dadba04f275774d4ab83f74cf25.tar.xz
ansible-975f66f2eebe9dadba04f275774d4ab83f74cf25.zip
Adding upstream version 7.7.0+dfsg.upstream/7.7.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/purestorage/fusion/tests/integration')
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/README.md10
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/integration_config.template6
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_az/tasks/main.yml43
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_hap/tasks/main.yml42
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ni/tasks/main.yml37
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_nig/tasks/main.yml48
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_pg/tasks/main.yml95
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_pp/tasks/main.yml43
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_region/tasks/main.yml53
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_sc/tasks/main.yml94
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_se/tasks/main.yml100
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ss/tasks/main.yml77
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_tenant/tasks/main.yml41
-rw-r--r--ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ts/tasks/main.yml62
14 files changed, 751 insertions, 0 deletions
diff --git a/ansible_collections/purestorage/fusion/tests/integration/README.md b/ansible_collections/purestorage/fusion/tests/integration/README.md
new file mode 100644
index 000000000..7ca8ee497
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/README.md
@@ -0,0 +1,10 @@
+# Integration tests
+
+## Running tests
+
+- Copy `tests/integration/integration_config.template` to `tests/integration/integration_config.yml` and fill out the
+ env variables
+- Run with the following command:
+ ```bash
+ ansible-test integration
+ ```
diff --git a/ansible_collections/purestorage/fusion/tests/integration/integration_config.template b/ansible_collections/purestorage/fusion/tests/integration/integration_config.template
new file mode 100644
index 000000000..3fd6e77d3
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/integration_config.template
@@ -0,0 +1,6 @@
+---
+test_env:
+ FUSION_API_HOST: <FUSION_API_HOST>
+ FUSION_ISSUER_ID: <API_ID>
+ FUSION_PRIVATE_KEY_FILE: <PRIVATE_KEY>
+ FUSION_TOKEN_ENDPOINT: <STAGING_TOKEN_ENDPOINT> \ No newline at end of file
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_az/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_az/tasks/main.yml
new file mode 100644
index 000000000..b9c23fc8c
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_az/tasks/main.yml
@@ -0,0 +1,43 @@
+- name: Create Availability Zone
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_az:
+ name: "test_az"
+ display_name: "foo AZ"
+ region: pure-us-west
+ register: result
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect Availability Zones and verify the zone exists
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_info:
+ gather_subset: availability_zones
+ register: fusion_info
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'test_az' in fusion_info['fusion_info']['availability_zones']"
+
+- name: Delete AZ
+ purestorage.fusion.fusion_az:
+ name: "test_az"
+ state: absent
+ region: pure-us-west
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect Availability Zones and verify the zone does not exist
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_info:
+ gather_subset: availability_zones
+ register: fusion_info
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'test_az' not in fusion_info['fusion_info']['availability_zones']"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_hap/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_hap/tasks/main.yml
new file mode 100644
index 000000000..eaea92684
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_hap/tasks/main.yml
@@ -0,0 +1,42 @@
+- name: Create new Linux host access policy
+ purestorage.fusion.fusion_hap:
+ name: hap_foo
+ personality: linux
+ iqn: "iqn.2005-03.com.RedHat:linux-host1"
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect hosts and check the host exists
+ purestorage.fusion.fusion_info:
+ gather_subset: host_access_policies
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'hap_foo' in fusion_info['fusion_info']['host_access_policies']"
+
+- name: Delete host access policy
+ purestorage.fusion.fusion_hap:
+ name: hap_foo
+ state: absent
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect hosts and check the host does not exist
+ purestorage.fusion.fusion_info:
+ gather_subset: host_access_policies
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'hap_foo' not in fusion_info['fusion_info']['host_access_policies']"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ni/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ni/tasks/main.yml
new file mode 100644
index 000000000..16b5359de
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ni/tasks/main.yml
@@ -0,0 +1,37 @@
+# TODO: Currently not possible to remove network interface group from network interface
+
+# Prepare
+- name: Create new network interface group foo in AZ bar
+ purestorage.fusion.fusion_nig:
+ name: "interface_group1"
+ availability_zone: az1
+ region: pure-us-west
+ state: present
+ mtu: 1500
+ gateway: 172.17.1.1
+ prefix: 172.17.1.0/24
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+
+# Test network interfaces
+
+- name: Patch the network interface
+ purestorage.fusion.fusion_ni:
+ name: ct0.eth4
+ region: pure-us-west
+ availability_zone: az1
+ array: doubleagent-2
+ eth: 172.17.1.2/24
+ enabled: true
+ network_interface_group: "interface_group1"
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_nig/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_nig/tasks/main.yml
new file mode 100644
index 000000000..8e3ab298b
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_nig/tasks/main.yml
@@ -0,0 +1,48 @@
+- name: Create new network interface group
+ purestorage.fusion.fusion_nig:
+ name: "foo_group"
+ availability_zone: az1
+ region: pure-us-west
+ state: present
+ mtu: 1500
+ gateway: 172.17.17.1
+ prefix: 172.17.17.0/24
+ environment: "{{ test_env }}"
+ register: result
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect network_interface_groups and check the group exist
+ purestorage.fusion.fusion_info:
+ gather_subset: network_interface_groups
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'pure-us-west/az1/foo_group' in fusion_info['fusion_info']['network_interface_groups']"
+
+- name: Delete network interface group
+ purestorage.fusion.fusion_nig:
+ name: "foo_group"
+ availability_zone: az1
+ region: pure-us-west
+ state: absent
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect network_interface_groups and check the group does not exist
+ purestorage.fusion.fusion_info:
+ gather_subset: network_interface_groups
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'pure-us-west/az1/foo_group' not in fusion_info['fusion_info']['network_interface_groups']"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_pg/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_pg/tasks/main.yml
new file mode 100644
index 000000000..f4d50a653
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_pg/tasks/main.yml
@@ -0,0 +1,95 @@
+# Prepare dependencies
+- name: Create new tenat foo_tenant
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ display_name: "tenant foo"
+ environment: "{{ test_env }}"
+
+- name: Create new tenant space foo_tenant_space for tenant_foo
+ purestorage.fusion.fusion_ts:
+ name: foo_tenant_space
+ tenant: foo_tenant
+ state: present
+ environment: "{{ test_env }}"
+
+- name: Create new storage service foo_service
+ purestorage.fusion.fusion_ss:
+ name: foo_service
+ hardware_types:
+ - flash-array-x
+ display_name: "test class"
+ environment: "{{ test_env }}"
+
+
+# Test placement groups
+
+- name: Create new placement group named foo_pg
+ purestorage.fusion.fusion_pg:
+ name: foo_pg
+ tenant: foo_tenant
+ tenant_space: foo_tenant_space
+ availability_zone: az1
+ region: pure-us-west
+ storage_service: foo_service
+ state: present
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect placement_groups and check the placement group exists
+ purestorage.fusion.fusion_info:
+ gather_subset: placement_groups
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_tenant/foo_tenant_space/foo_pg' in fusion_info['fusion_info']['placement_groups']"
+
+- name: Delete placement group foo
+ purestorage.fusion.fusion_pg:
+ name: foo_pg
+ tenant: foo_tenant
+ tenant_space: foo_tenant_space
+ state: absent
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect placement_groups and check the placement group does not exist
+ purestorage.fusion.fusion_info:
+ gather_subset: placement_groups
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_tenant/foo_tenant_space/foo_pg' not in fusion_info['fusion_info']['placement_groups']"
+
+
+# Teardown dependencies
+
+- name: Delete storage service foo_service
+ purestorage.fusion.fusion_ss:
+ name: foo_service
+ state: absent
+ environment: "{{ test_env }}"
+
+- name: Delete foo_tenant_space
+ purestorage.fusion.fusion_ts:
+ name: foo_tenant_space
+ tenant: foo_tenant
+ state: absent
+ environment: "{{ test_env }}"
+
+- name: Delete tenat foo
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ state: absent
+ environment: "{{ test_env }}"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_pp/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_pp/tasks/main.yml
new file mode 100644
index 000000000..f8a126662
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_pp/tasks/main.yml
@@ -0,0 +1,43 @@
+- name: Create new protection policy foo_pp
+ purestorage.fusion.fusion_pp:
+ name: foo_pp
+ local_rpo: 10
+ local_retention: 4d
+ display_name: "foo pp"
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect protection policies and check the policy exists
+ purestorage.fusion.fusion_info:
+ gather_subset: protection_policies
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_pp' in fusion_info['fusion_info']['protection_policies']"
+
+- name: Delete protection policy foo_pp
+ purestorage.fusion.fusion_pp:
+ name: foo_pp
+ state: absent
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect protection policies and check the policy does not exist
+ purestorage.fusion.fusion_info:
+ gather_subset: protection_policies
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_pp' not in fusion_info['fusion_info']['protection_policies']"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_region/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_region/tasks/main.yml
new file mode 100644
index 000000000..8e0112f6d
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_region/tasks/main.yml
@@ -0,0 +1,53 @@
+- name: Create Region foo_region
+ purestorage.fusion.fusion_region:
+ name: "foo_region"
+ display_name: "foo Region"
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect Regions and verify the region exists
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_info:
+ gather_subset: regions
+ register: fusion_info
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_region' in fusion_info['fusion_info']['regions']"
+
+- name: Update Region display_name
+ purestorage.fusion.fusion_region:
+ name: "foo_region"
+ display_name: "new foo Region"
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Delete Region
+ purestorage.fusion.fusion_region:
+ name: "foo_region"
+ state: absent
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect Regions and verify the region does not exist
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_info:
+ gather_subset: regions
+ register: fusion_info
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_region' not in fusion_info['fusion_info']['regions']"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_sc/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_sc/tasks/main.yml
new file mode 100644
index 000000000..6420db28c
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_sc/tasks/main.yml
@@ -0,0 +1,94 @@
+# Prepare dependencies
+- name: Create new tenat foo_tenant
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ display_name: "tenant foo"
+ environment: "{{ test_env }}"
+
+- name: Create new tenant space foo_tenant_space for tenant_foo
+ purestorage.fusion.fusion_ts:
+ name: foo_tenant_space
+ tenant: foo_tenant
+ state: present
+ environment: "{{ test_env }}"
+
+- name: Create new storage service foo_service
+ purestorage.fusion.fusion_ss:
+ name: foo_service
+ hardware_types:
+ - flash-array-x
+ display_name: "test class"
+ environment: "{{ test_env }}"
+
+
+# Test storage classes
+
+- name: Create new storage class foo_sc
+ purestorage.fusion.fusion_sc:
+ name: foo_sc
+ size_limit: 100G
+ iops_limit: 100000
+ bw_limit: 25M
+ storage_service: foo_service
+ display_name: "test class"
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+
+- name: Collect storage classes and verify the class exists
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_info:
+ gather_subset: storage_classes
+ register: fusion_info
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_sc' in fusion_info['fusion_info']['storage_classes']"
+
+- name: Delete storage class
+ purestorage.fusion.fusion_sc:
+ name: foo_sc
+ storage_service: foo_service
+ state: absent
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect storage classes and verify the class does not exist
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_info:
+ gather_subset: storage_classes
+ register: fusion_info
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_sc' not in fusion_info['fusion_info']['storage_classes']"
+
+
+# Teardown dependencies
+
+- name: Delete storage service foo_service
+ purestorage.fusion.fusion_ss:
+ name: foo_service
+ state: absent
+ environment: "{{ test_env }}"
+
+- name: Delete foo_tenant_space
+ purestorage.fusion.fusion_ts:
+ name: foo_tenant_space
+ tenant: foo_tenant
+ state: absent
+ environment: "{{ test_env }}"
+
+- name: Delete tenat foo
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ state: absent
+ environment: "{{ test_env }}"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_se/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_se/tasks/main.yml
new file mode 100644
index 000000000..a900712ec
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_se/tasks/main.yml
@@ -0,0 +1,100 @@
+# Prepare dependencies
+
+- name: Create Availability Zone
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_az:
+ name: "test_az"
+ display_name: "foo AZ"
+ region: pure-us-west
+ register: result
+
+- name: Create new network interface group
+ purestorage.fusion.fusion_nig:
+ name: "foo_group"
+ availability_zone: test_az
+ region: pure-us-west
+ state: present
+ mtu: 1500
+ gateway: 172.17.17.1
+ prefix: 172.17.17.0/24
+ environment: "{{ test_env }}"
+
+
+# Test storage classes
+
+- name: Create new Storage Endpoint
+ purestorage.fusion.fusion_se:
+ state: present # or absent
+ region: pure-us-west
+ name: foo_se
+ display_name: "foo se"
+ availability_zone: test_az
+ endpoint_type: iscsi
+ iscsi:
+ - address: "172.17.1.2/24"
+ gateway: "172.17.1.1"
+ network_interface_groups: ["foo_group"]
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect storage endpoints and verify the endpoint exists
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_info:
+ gather_subset: storage_endpoints
+ register: fusion_info
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'pure-us-west/test_az/foo_se' in fusion_info['fusion_info']['storage_endpoints']"
+
+- name: Delete Storage Endpoint
+ purestorage.fusion.fusion_se:
+ state: absent
+ region: pure-us-west
+ name: foo_se
+ display_name: "foo se"
+ availability_zone: test_az
+ endpoint_type: iscsi
+ iscsi:
+ - address: "172.17.1.2/24"
+ gateway: "172.17.1.1"
+ network_interface_groups: ["foo_group"]
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect storage endpoints and verify the endpoint does not exist
+ environment: "{{ test_env }}"
+ purestorage.fusion.fusion_info:
+ gather_subset: storage_endpoints
+ register: fusion_info
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'pure-us-west/test_az/foo_se' not in fusion_info['fusion_info']['storage_endpoints']"
+
+
+# Teardown dependencies
+
+- name: Delete network interface group
+ purestorage.fusion.fusion_nig:
+ name: "foo_group"
+ availability_zone: test_az
+ region: pure-us-west
+ state: absent
+ environment: "{{ test_env }}"
+
+- name: Delete AZ
+ purestorage.fusion.fusion_az:
+ name: "test_az"
+ state: absent
+ region: pure-us-west
+ register: result
+ environment: "{{ test_env }}"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ss/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ss/tasks/main.yml
new file mode 100644
index 000000000..26332fcf7
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ss/tasks/main.yml
@@ -0,0 +1,77 @@
+# Prepare dependencies
+- name: Create new tenat foo_tenant
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ display_name: "tenant foo"
+ environment: "{{ test_env }}"
+
+- name: Create new tenant space foo_tenant_space for tenant_foo
+ purestorage.fusion.fusion_ts:
+ name: foo_tenant_space
+ tenant: foo_tenant
+ state: present
+ environment: "{{ test_env }}"
+
+
+# Test storage services
+
+- name: Create new storage service foo_service
+ purestorage.fusion.fusion_ss:
+ name: foo_service
+ hardware_types:
+ - flash-array-x
+ display_name: "test class"
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+
+- name: Collect storage services and check the service exists
+ purestorage.fusion.fusion_info:
+ gather_subset: storage_services
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_service' in fusion_info['fusion_info']['storage_services']"
+
+- name: Delete storage service foo_service
+ purestorage.fusion.fusion_ss:
+ name: foo_service
+ state: absent
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect storage services and check the service does not exist
+ purestorage.fusion.fusion_info:
+ gather_subset: storage_services
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_service' not in fusion_info['fusion_info']['storage_services']"
+
+
+# Teardown dependencies
+
+- name: Delete foo_tenant_space
+ purestorage.fusion.fusion_ts:
+ name: foo_tenant_space
+ tenant: foo_tenant
+ state: absent
+ environment: "{{ test_env }}"
+
+- name: Delete tenat foo
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ state: absent
+ environment: "{{ test_env }}"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_tenant/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_tenant/tasks/main.yml
new file mode 100644
index 000000000..262c74a73
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_tenant/tasks/main.yml
@@ -0,0 +1,41 @@
+- name: Create new tenat foo_tenant
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ display_name: "tenant foo"
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect tenants and check the tenant exists
+ purestorage.fusion.fusion_info:
+ gather_subset: tenants
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_tenant' in fusion_info['fusion_info']['tenants']"
+
+- name: Delete tenat foo
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ state: absent
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect tenants and check the tenant does notexist
+ purestorage.fusion.fusion_info:
+ gather_subset: tenants
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_tenant' not in fusion_info['fusion_info']['tenants']"
diff --git a/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ts/tasks/main.yml b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ts/tasks/main.yml
new file mode 100644
index 000000000..101c3f251
--- /dev/null
+++ b/ansible_collections/purestorage/fusion/tests/integration/targets/fusion_ts/tasks/main.yml
@@ -0,0 +1,62 @@
+# Prepare dependencies
+- name: Create new tenat foo_tenant
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ display_name: "tenant foo"
+ environment: "{{ test_env }}"
+
+
+# Test tenant spaces
+
+- name: Create new tenant space foo_tenant_space for tenant_foo
+ purestorage.fusion.fusion_ts:
+ name: foo_tenant_space
+ tenant: foo_tenant
+ state: present
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect tenant spaces and check the tenant space exists
+ purestorage.fusion.fusion_info:
+ gather_subset: tenant_spaces
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_tenant/foo_tenant_space' in fusion_info['fusion_info']['tenant_spaces']"
+
+- name: Delete foo_tenant_space
+ purestorage.fusion.fusion_ts:
+ name: foo_tenant_space
+ tenant: foo_tenant
+ state: absent
+ register: result
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that:
+ - result is success
+ - result is changed
+
+- name: Collect tenant spaces and check the tenant space does not exist
+ purestorage.fusion.fusion_info:
+ gather_subset: tenant_spaces
+ register: fusion_info
+ environment: "{{ test_env }}"
+- name: Validate the task
+ ansible.builtin.assert:
+ that: "'foo_tenant/foo_tenant_space' not in fusion_info['fusion_info']['tenant_spaces']"
+
+
+# Teardown dependencies
+
+- name: Delete tenat foo
+ purestorage.fusion.fusion_tenant:
+ name: foo_tenant
+ state: absent
+ environment: "{{ test_env }}"