diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index a683b5bbdb7..89eef1bbcc3 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -684,6 +684,7 @@ sharkanodo shasta shazbat shortkey +shortlived showmuted sigch sigevent diff --git a/bats/tests/containers/factory-reset-snapshots.bats b/bats/tests/containers/factory-reset-snapshots.bats new file mode 100644 index 00000000000..e1bc294bea1 --- /dev/null +++ b/bats/tests/containers/factory-reset-snapshots.bats @@ -0,0 +1,29 @@ +load '../helpers/load' + +@test 'factory reset' { + delete_all_snapshots + factory_reset +} + +@test 'Start up Rancher Desktop with a snapshots subdirectory' { + start_container_engine + wait_for_container_engine + wait_for_backend +} + +@test "Verify the snapshot dir isn't deleted on factory-reset" { + rdctl shutdown + rdctl snapshot create shortlived-snapshot + rdctl factory-reset + assert_not_exists "$PATH_APP_HOME/rd-engine.json" + assert_exists "$PATH_SNAPSHOTS" + run ls -A "$PATH_SNAPSHOTS" + assert_output + test -n "$output" +} + +@test 'Verify factory-reset deletes an empty snapshots directory' { + rdctl snapshot delete shortlived-snapshot + rdctl factory-reset + assert_not_exists "$PATH_APP_HOME" +}