@@ -24,8 +24,9 @@ source "${SCRIPT_DIR}/lib-test.sh"
2424# Nothing here touches a real system: every function that looks outward is
2525# replaced, and the files the checks read live in a temporary directory.
2626MOCK_VIRT=" none"
27- MOCK_SUBVOLUMES=" @os /
28- @data /data"
27+ MOCK_SUBVOLUMES=" @os/system-A /
28+ @data /data
29+ @swap /swap"
2930MOCK_ADDRESSES=" eth0 10.0.0.5/24"
3031MOCK_HOSTNAME=" my-system"
3132MOCK_DOCKER_OK=0
@@ -46,8 +47,9 @@ journal_errors() { echo "${MOCK_JOURNAL_ERRORS}"; }
4647reset_system () {
4748 RESULTS=()
4849 MOCK_VIRT=" none"
49- MOCK_SUBVOLUMES=" @os /
50- @data /data"
50+ MOCK_SUBVOLUMES=" @os/system-A /
51+ @data /data
52+ @swap /swap"
5153 MOCK_ADDRESSES=" eth0 10.0.0.5/24"
5254 MOCK_HOSTNAME=" my-system"
5355 MOCK_DOCKER_OK=0
@@ -117,12 +119,19 @@ break_slot() { echo "C" >"${T_FILE_SLOT}"; }
117119expect " slot: A or B, nothing else" " failed" status_of slot break_slot
118120expect " slot: an empty file fails" " failed" status_of slot rm -f " ${T_FILE_SLOT} "
119121
120- drop_data_subvolume () { MOCK_SUBVOLUMES=" @os /" ; }
122+ drop_data_subvolume () { MOCK_SUBVOLUMES=" @os/system-A /" ; }
121123expect " subvolumes: a missing @data fails" " failed" status_of subvolumes \
122124 drop_data_subvolume
123125expect " subvolumes: the failure names it" " not mounted: @data" detail_of \
124126 subvolumes drop_data_subvolume
125127
128+ # The root is @os/system-A or @os/system-B, never @os itself.
129+ expect " subvolumes: the slot below @os counts as @os" " ok" status_of subvolumes
130+ lose_the_os_subvolume () { MOCK_SUBVOLUMES=" @osold/system-A /
131+ @data /data" ; }
132+ expect " subvolumes: a subvolume merely starting with @os does not" " failed" \
133+ status_of subvolumes lose_the_os_subvolume
134+
126135be_a_container () { MOCK_VIRT=" lxc" ; }
127136expect " subvolumes: skipped in a container" " skipped" status_of subvolumes \
128137 be_a_container
0 commit comments