Skip to content

Commit

Permalink
Merge pull request rancher-sandbox#5424 from rancher-sandbox/5423-tes…
Browse files Browse the repository at this point in the history
…t-factory-reset-with-snapshots

Test presence/absence of apphome/snapshots.
  • Loading branch information
jandubois authored Oct 25, 2023
2 parents fe9220f + ece52fb commit b75e32f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ sharkanodo
shasta
shazbat
shortkey
shortlived
showmuted
sigch
sigevent
Expand Down
29 changes: 29 additions & 0 deletions bats/tests/containers/factory-reset-snapshots.bats
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit b75e32f

Please sign in to comment.