From 0109324f97a9aae5d5bfd0bf20bf5a24448b00ce Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Tue, 12 Oct 2021 19:11:35 -0700 Subject: [PATCH] Add remove suite back Signed-off-by: Lance Albertson --- kitchen.yml | 3 ++ .../remove/bats/verify_removed.bats | 50 ------------------- test/integration/remove/remove_spec.rb | 20 ++++++++ .../bats-old/verify_resize_thin.bats | 6 --- .../verify_resize_thin_pool_meta_data.bats | 6 --- 5 files changed, 23 insertions(+), 62 deletions(-) delete mode 100644 test/integration/remove/bats/verify_removed.bats create mode 100644 test/integration/remove/remove_spec.rb delete mode 100644 test/integration/resize_thin/bats-old/verify_resize_thin.bats delete mode 100644 test/integration/resize_thin_pool_meta_data/bats-old/verify_resize_thin_pool_meta_data.bats diff --git a/kitchen.yml b/kitchen.yml index efe6220b..c97f7d1c 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -29,6 +29,9 @@ suites: - name: create run_list: - recipe[test::create] + - name: remove + run_list: + - recipe[test::remove] - name: create_thin run_list: - recipe[test::create_thin] diff --git a/test/integration/remove/bats/verify_removed.bats b/test/integration/remove/bats/verify_removed.bats deleted file mode 100644 index 0d7384cf..00000000 --- a/test/integration/remove/bats/verify_removed.bats +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bats - -# On CentOS 5, most of the commands used here are not in PATH. So add them -# here. -export PATH=$PATH:/sbin:/usr/sbin - -# physical volumes should be setup -@test "creates the physical volumes" { - pvs | grep /dev/loop10 - pvs | grep /dev/loop11 - pvs | grep /dev/loop12 - pvs | grep /dev/loop13 -} - -# volume group should be created -@test "creates the volume group vg-rmdata" { - vgs | grep vg-rmdata -} - -# volume group should have all space available -@test "all space is available in the volume group" { - vsize = vgs | grep vg-rmdata | cut -d' ' -f14 - vfree = vgs | grep vg-rmdata | cut -d' ' -f15 - [ "$vsize" -eq "$vfree" ] -} - -# This should not exist, as it was deleted -@test "removes the logical volume rmlogs on vg-rmdata" { - lvs | grep rmlogs - [ $status = 0 ] -} - -# This should not exist, as it was deleted -@test "removes the logical volume rmtest on vg-rmdata" { - lvs | grep rmtest - [ $status = 0 ] -} - -@test "mount location should be created for /mnt/rmlogs" { - ls /mnt | grep rmlogs -} - -@test "Exposed mount point mode should be 755" { - ls -la /mnt/rmlogs | grep "drwxr-xr-x" -} - -@test "mount location should NOT be created for /mnt/rmtest, as it was deleted" { - ls /mnt | grep rmtest - [ $status = 0 ] -} diff --git a/test/integration/remove/remove_spec.rb b/test/integration/remove/remove_spec.rb new file mode 100644 index 00000000..9cf62f6c --- /dev/null +++ b/test/integration/remove/remove_spec.rb @@ -0,0 +1,20 @@ +describe command 'pvs' do + its('stdout') { should match %r{/dev/loop10\s+vg-rmdata\s+lvm2\s+a--\s+124.00m\s+124.00m} } + its('stdout') { should match %r{/dev/loop11\s+vg-rmdata\s+lvm2\s+a--\s+124.00m\s+124.00m} } + its('stdout') { should match %r{/dev/loop12\s+vg-rmdata\s+lvm2\s+a--\s+124.00m\s+124.00m} } + its('stdout') { should match %r{/dev/loop13\s+vg-rmdata\s+lvm2\s+a--\s+124.00m\s+124.00m} } +end + +describe command 'lvs' do + its('stdout') { should_not match 'rmlogs' } + its('stdout') { should_not match 'rmtest' } +end + +describe directory '/mnt/rmlogs' do + it { should exist } + its('mode') { should cmp '0755' } +end + +describe directory '/mnt/rmtest' do + it { should_not exist } +end diff --git a/test/integration/resize_thin/bats-old/verify_resize_thin.bats b/test/integration/resize_thin/bats-old/verify_resize_thin.bats deleted file mode 100644 index 5bb66525..00000000 --- a/test/integration/resize_thin/bats-old/verify_resize_thin.bats +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bats - -@test "resizes the thin logical volume 'thin_vol_1' to 32 MiB" { - lvsize="$(lvdisplay /dev/vg-test/thin_vol_1|awk '/LV Size/ {print $3 $4}')" - [ "$lvsize" == "32.00MiB" ] -} diff --git a/test/integration/resize_thin_pool_meta_data/bats-old/verify_resize_thin_pool_meta_data.bats b/test/integration/resize_thin_pool_meta_data/bats-old/verify_resize_thin_pool_meta_data.bats deleted file mode 100644 index 23fa567d..00000000 --- a/test/integration/resize_thin_pool_meta_data/bats-old/verify_resize_thin_pool_meta_data.bats +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bats - -@test "resizes the thin pool metadata volume 'lv-thin-pool_tmeta' to 128m" { - metadata_size="$(lvs --options meta_data_lv,lv_metadata_size|awk '/lv-thin_tmeta/ {print $2}')" - [ "$metadata_size" == "128.00m" ] -}