From 36da735ad34a9b7c0cd2067adbd8124eef1641d4 Mon Sep 17 00:00:00 2001 From: David Lehman Date: Wed, 3 Jul 2019 13:38:17 -0400 Subject: [PATCH] Test for idempotence explicitly in all integration tests. --- tests/tests_change_disk_fs.yml | 13 +++++++ tests/tests_change_disk_mount.yml | 12 ++++++ tests/tests_change_fs.yml | 15 ++++++++ tests/tests_change_fs_use_partitions.yml | 15 ++++++++ tests/tests_change_mount.yml | 14 +++++++ tests/tests_create_disk_then_remove.yml | 12 ++++++ tests/tests_create_lvm_pool_then_remove.yml | 37 +++++++++++++++++++ ...ts_create_partition_volume_then_remove.yml | 32 ++++++++++++++++ tests/tests_filesystem_one_disk.yml | 12 ++++++ ...ts_lvm_multiple_disks_multiple_volumes.yml | 17 +++++++++ tests/tests_lvm_one_disk_multiple_volumes.yml | 20 ++++++++++ tests/tests_lvm_one_disk_one_volume.yml | 14 +++++++ tests/tests_remove_mount.yml | 14 +++++++ 13 files changed, 227 insertions(+) diff --git a/tests/tests_change_disk_fs.yml b/tests/tests_change_disk_fs.yml index be48acfd..b6aa80ba 100644 --- a/tests/tests_change_disk_fs.yml +++ b/tests/tests_change_disk_fs.yml @@ -40,6 +40,19 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_volumes: + - name: test1 + type: disk + mount_point: "{{ mount_location }}" + fs_type: "{{ fs_type_after }}" + disks: "{{ unused_disks }}" + + - include_tasks: verify-role-results.yml + - name: Clean up include_role: name: storage diff --git a/tests/tests_change_disk_mount.yml b/tests/tests_change_disk_mount.yml index fc522629..5998cf4b 100644 --- a/tests/tests_change_disk_mount.yml +++ b/tests/tests_change_disk_mount.yml @@ -39,6 +39,18 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_volumes: + - name: test1 + type: disk + mount_point: "{{ mount_location_after }}" + disks: "{{ unused_disks }}" + + - include_tasks: verify-role-results.yml + - name: Clean up include_role: name: storage diff --git a/tests/tests_change_fs.yml b/tests/tests_change_fs.yml index 94c99d80..cca23ebe 100644 --- a/tests/tests_change_fs.yml +++ b/tests/tests_change_fs.yml @@ -44,6 +44,21 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + volumes: + - name: test1 + size: "{{ volume_size }}" + fs_type: "{{ fs_after }}" + mount_point: "{{ mount_location }}" + + - include_tasks: verify-role-results.yml + - name: Clean up include_role: name: storage diff --git a/tests/tests_change_fs_use_partitions.yml b/tests/tests_change_fs_use_partitions.yml index 9f81731d..e4aa76cd 100644 --- a/tests/tests_change_fs_use_partitions.yml +++ b/tests/tests_change_fs_use_partitions.yml @@ -45,6 +45,21 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: bar + disks: "{{ unused_disks }}" + volumes: + - name: test1 + size: "{{ volume_size }}" + fs_type: "{{ fs_type_after }}" + mount_point: "{{ mount_location }}" + + - include_tasks: verify-role-results.yml + - name: Clean up include_role: name: storage diff --git a/tests/tests_change_mount.yml b/tests/tests_change_mount.yml index 9ce99a9a..c22565d8 100644 --- a/tests/tests_change_mount.yml +++ b/tests/tests_change_mount.yml @@ -43,6 +43,20 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + volumes: + - name: test1 + size: "{{ volume_size }}" + mount_point: "{{ mount_location_after }}" + + - include_tasks: verify-role-results.yml + - name: Clean up include_role: name: storage diff --git a/tests/tests_create_disk_then_remove.yml b/tests/tests_create_disk_then_remove.yml index 1cfc23b2..b19ae352 100644 --- a/tests/tests_create_disk_then_remove.yml +++ b/tests/tests_create_disk_then_remove.yml @@ -24,6 +24,18 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_volumes: + - name: test1 + type: disk + disks: "{{ unused_disks }}" + mount_point: "{{ mount_location }}" + + - include_tasks: verify-role-results.yml + - name: Remove the disk device created above include_role: name: storage diff --git a/tests/tests_create_lvm_pool_then_remove.yml b/tests/tests_create_lvm_pool_then_remove.yml index 757c57b2..6b259396 100644 --- a/tests/tests_create_lvm_pool_then_remove.yml +++ b/tests/tests_create_lvm_pool_then_remove.yml @@ -34,6 +34,43 @@ - include_tasks: verify-role-results.yml + - name: Remove one of the LVM logical volumes in 'foo' created above + include_role: + name: storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + state: "present" + volumes: + - name: test1 + size: "{{ volume1_size }}" + mount_point: "{{ mount_location1 }}" + - name: test2 + size: "{{ volume2_size }}" + mount_point: "{{ mount_location2 }}" + state: absent + + - include_tasks: verify-role-results.yml + + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + volumes: + - name: test1 + size: "{{ volume1_size }}" + mount_point: "{{ mount_location1 }}" + - name: test2 + size: "{{ volume2_size }}" + mount_point: "{{ mount_location2 }}" + state: absent + + - include_tasks: verify-role-results.yml + - name: Remove both of the LVM logical volumes in 'foo' created above include_role: name: storage diff --git a/tests/tests_create_partition_volume_then_remove.yml b/tests/tests_create_partition_volume_then_remove.yml index 5c18d9fc..40b3e620 100644 --- a/tests/tests_create_partition_volume_then_remove.yml +++ b/tests/tests_create_partition_volume_then_remove.yml @@ -27,6 +27,21 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: "{{ unused_disks[0] }}" + type: disk + disks: "{{ unused_disks }}" + volumes: + - name: test1 + type: partition + mount_point: "{{ mount_location }}" + + - include_tasks: verify-role-results.yml + - name: Remove the partition created above include_role: name: storage @@ -43,3 +58,20 @@ state: absent - include_tasks: verify-role-results.yml + + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: "{{ unused_disks[0] }}" + type: disk + disks: "{{ unused_disks }}" + state: absent + volumes: + - name: "{{ unused_disks[0] }}1" + type: partition + mount_point: "{{ mount_location }}" + state: absent + + - include_tasks: verify-role-results.yml diff --git a/tests/tests_filesystem_one_disk.yml b/tests/tests_filesystem_one_disk.yml index 531843c2..591e4fbd 100644 --- a/tests/tests_filesystem_one_disk.yml +++ b/tests/tests_filesystem_one_disk.yml @@ -24,6 +24,18 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_volumes: + - name: test1 + type: disk + mount_point: "{{ mount_location }}" + disks: "{{ unused_disks }}" + + - include_tasks: verify-role-results.yml + - name: Clean up include_role: name: storage diff --git a/tests/tests_lvm_multiple_disks_multiple_volumes.yml b/tests/tests_lvm_multiple_disks_multiple_volumes.yml index 57a492d7..bbc7bb01 100644 --- a/tests/tests_lvm_multiple_disks_multiple_volumes.yml +++ b/tests/tests_lvm_multiple_disks_multiple_volumes.yml @@ -40,6 +40,23 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: phi + disks: "{{ unused_disks }}" + volumes: + - name: test1 + size: "{{ volume_size }}" + mount_point: "{{ mount_location1 }}" + - name: test2 + size: "{{ volume_size }}" + mount_point: "{{ mount_location2 }}" + + - include_tasks: verify-role-results.yml + - name: Clean up include_role: name: storage diff --git a/tests/tests_lvm_one_disk_multiple_volumes.yml b/tests/tests_lvm_one_disk_multiple_volumes.yml index a02ecf81..d19d245a 100644 --- a/tests/tests_lvm_one_disk_multiple_volumes.yml +++ b/tests/tests_lvm_one_disk_multiple_volumes.yml @@ -34,6 +34,26 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + volumes: + - name: test1 + size: "{{ volume_size }}" + mount_point: '/opt/test1' + - name: test2 + size: "{{ volume_size }}" + mount_point: '/opt/test2' + - name: test3 + size: "{{ volume_size }}" + mount_point: '/opt/test3' + + - include_tasks: verify-role-results.yml + - name: Remove two of the LVs include_role: name: storage diff --git a/tests/tests_lvm_one_disk_one_volume.yml b/tests/tests_lvm_one_disk_one_volume.yml index 8c5a7c2d..abe1b5fa 100644 --- a/tests/tests_lvm_one_disk_one_volume.yml +++ b/tests/tests_lvm_one_disk_one_volume.yml @@ -29,6 +29,20 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + volumes: + - name: test1 + size: "{{ volume_size }}" + mount_point: "{{ mount_location }}" + + - include_tasks: verify-role-results.yml + - name: Clean up include_role: name: storage diff --git a/tests/tests_remove_mount.yml b/tests/tests_remove_mount.yml index c33028f1..2f2841c6 100644 --- a/tests/tests_remove_mount.yml +++ b/tests/tests_remove_mount.yml @@ -43,6 +43,20 @@ - include_tasks: verify-role-results.yml + - name: Repeat the previous invocation to verify idempotence + include_role: + name: storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + volumes: + - name: test1 + size: "{{ volume_size }}" + mount_point: "{{ mount_location_after }}" + + - include_tasks: verify-role-results.yml + - name: Clean up include_role: name: storage