Skip to content

Commit

Permalink
refactor and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
evanson committed Sep 2, 2022
1 parent 97f3c62 commit df6c261
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
27 changes: 23 additions & 4 deletions tests/suites/storage/charm_storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ run_charm_storage() {

# Assess charm storage with the filesystem storage provider
echo "Assessing filesystem rootfs"
juju deploy ./tests/suites/storage/charms/dummy-storage-fs --series="jammy" --storage data=rootfs,1G
juju deploy ./testcharms/charms/dummy-storage-fs --series="jammy" --storage data=rootfs,1G
wait_for "dummy-storage-fs" ".applications"
# assert the storage kind name
juju list-storage --format json | jq '.storage[] | .kind' | check "filesystem"
Expand All @@ -49,7 +49,7 @@ run_charm_storage() {
# Assess charm storage with the filesystem storage provider

echo "Assessing block loop disk 1"
juju deploy ./tests/suites/storage/charms/dummy-storage-lp --series="jammy" --storage disks=loop,1G
juju deploy ./testcharms/charms/dummy-storage-lp --series="jammy" --storage disks=loop,1G
wait_for "dummy-storage-lp" ".applications"
# assert the storage kind name
juju list-storage --format json | jq '.storage | .["disks/1"] | .kind' | check "block"
Expand Down Expand Up @@ -77,7 +77,7 @@ run_charm_storage() {
wait_for "{}" ".applications"

echo "Assessing filesystem tmpfs"
juju deploy -m "${model_name}" ./tests/suites/storage/charms/dummy-storage-tp --series jammy --storage data=tmpfs,1G
juju deploy -m "${model_name}" ./testcharms/charms/dummy-storage-tp --series jammy --storage data=tmpfs,1G
wait_for "dummy-storage-tp" ".applications"
# assert the storage kind name
juju list-storage --format json | jq '.storage[] | .kind' | check "filesystem"
Expand All @@ -93,7 +93,7 @@ run_charm_storage() {
wait_for "{}" ".applications"

echo "Assessing filesystem"
juju deploy -m "${model_name}" ./tests/suites/storage/charms/dummy-storage-np --series jammy --storage data=1G
juju deploy -m "${model_name}" ./testcharms/charms/dummy-storage-np --series jammy --storage data=1G
wait_for "dummy-storage-np" ".applications"
# assert the storage kind name
juju list-storage --format json | jq '.storage[] | .kind' | check "filesystem"
Expand All @@ -107,6 +107,25 @@ run_charm_storage() {
# remove application
juju remove-application dummy-storage-np
wait_for "{}" ".applications"
# We remove storage data/4 since in Juju 2.3+ it is persistent. Otherwise it will interfere with the next test's results
juju remove-storage data/4

echo "Assessing multiple filesystem, block, rootfs, loop"
juju deploy -m "${model_name}" ./testcharms/charms/dummy-storage-mp --series jammy --storage data=1G
wait_for "dummy-storage-mp" ".applications"
# assert the storage kind name
juju list-storage --format json | jq '.storage | .["data/5"] | .kind' | check "filesystem"
# assert the storage label name
juju list-storage --format json | jq '.storage | keys | .[0]' | check "data/5"
# assert the unit attachment name
juju list-storage --format json | jq '.storage | .["data/5"] | .attachments | .units | keys | .[]' | check "dummy-storage-mp/0"
# assert the attached unit state
juju list-storage --format json | jq '.storage | .["data/5"] | .attachments | .units[] | .life' | check "alive"
echo "Multiple filesystem, block, rootfs, loop PASSED"
# remove application
juju remove-application dummy-storage-mp
wait_for "{}" ".applications"
echo "All charm storage tests PASSED"

destroy_model "${model_name}"
}
Expand Down
5 changes: 1 addition & 4 deletions tests/suites/storage/task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ test_storage() {

bootstrap "test-storage" "${file}"

test_block_storage
test_rootfs_storage
test_tmpfs_storage
test_fs_storage
test_charm_storage

destroy_controller "test-storage"
}

0 comments on commit df6c261

Please sign in to comment.