bectl_test.sh (7f49ce7a0b5f0d501d233308d73ccb1bf191a68b) | bectl_test.sh (8f5c6c31ae7b2fe787fbe11909e33fd151c6d524) |
---|---|
1# 2# SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3# 4# Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 148 unchanged lines hidden (view full) --- 157 158 # Test origin snapshot deletion when the snapshot to be destroyed 159 # belongs to a mounted dataset, see PR 236043. 160 atf_check mkdir -p ${root} 161 atf_check -o not-empty bectl -r ${zpool}/ROOT mount default ${root} 162 atf_check bectl -r ${zpool}/ROOT create -e default default3 163 atf_check bectl -r ${zpool}/ROOT destroy -o default3 164 atf_check bectl -r ${zpool}/ROOT unmount default | 1# 2# SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3# 4# Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 148 unchanged lines hidden (view full) --- 157 158 # Test origin snapshot deletion when the snapshot to be destroyed 159 # belongs to a mounted dataset, see PR 236043. 160 atf_check mkdir -p ${root} 161 atf_check -o not-empty bectl -r ${zpool}/ROOT mount default ${root} 162 atf_check bectl -r ${zpool}/ROOT create -e default default3 163 atf_check bectl -r ${zpool}/ROOT destroy -o default3 164 atf_check bectl -r ${zpool}/ROOT unmount default |
165 166 # create two be from the same parent and destroy the parent 167 atf_check bectl -r ${zpool}/ROOT create -e default default2 168 atf_check bectl -r ${zpool}/ROOT create -e default default3 169 atf_check bectl -r ${zpool}/ROOT destroy default 170 atf_check bectl -r ${zpool}/ROOT destroy default2 171 atf_check bectl -r ${zpool}/ROOT rename default3 default 172 173 # Create a BE, have it be the parent for another and repeat, then start 174 # deleting environments. Arbitrarily chose default3 as the first. 175 # Sleeps are required to prevent conflicting snapshots- libbe will 176 # use the time with a serial at the end as needed to prevent collisions, 177 # but as BEs get promoted the snapshot names will convert and conflict 178 # anyways. libbe should perhaps consider adding something extra to the 179 # default name to prevent collisions like this, but the default name 180 # includes down to the second and creating BEs this rapidly is perhaps 181 # uncommon enough. 182 atf_check bectl -r ${zpool}/ROOT create -e default default2 183 sleep 1 184 atf_check bectl -r ${zpool}/ROOT create -e default2 default3 185 sleep 1 186 atf_check bectl -r ${zpool}/ROOT create -e default3 default4 187 atf_check bectl -r ${zpool}/ROOT destroy default3 188 atf_check bectl -r ${zpool}/ROOT destroy default2 189 atf_check bectl -r ${zpool}/ROOT destroy default4 190 191 # Create two BEs, then create an unrelated snapshot on the originating 192 # BE and destroy it. We shouldn't have promoted the second BE, and it's 193 # only possible to tell if we promoted it by making sure we didn't 194 # demote the first BE at some point -- if we did, it's origin will no 195 # longer be empty. 196 atf_check bectl -r ${zpool}/ROOT create -e default default2 197 atf_check bectl -r ${zpool}/ROOT create default@test 198 199 atf_check bectl -r ${zpool}/ROOT destroy default@test 200 atf_check -o inline:"-\n" zfs get -Ho value origin ${zpool}/ROOT/default 201 atf_check bectl -r ${zpool}/ROOT destroy default2 202 203 # As observed by beadm, if we explicitly try to destroy a snapshot that 204 # leads to clones, we shouldn't have allowed it. 205 atf_check bectl -r ${zpool}/ROOT create default@test 206 atf_check bectl -r ${zpool}/ROOT create -e default@test default2 207 208 atf_check -e not-empty -s not-exit:0 bectl -r ${zpool}/ROOT destroy \ 209 default@test |
|
165} 166bectl_destroy_cleanup() 167{ 168 169 bectl_cleanup $(get_zpool_name) 170} 171 172atf_test_case bectl_export_import cleanup --- 228 unchanged lines hidden --- | 210} 211bectl_destroy_cleanup() 212{ 213 214 bectl_cleanup $(get_zpool_name) 215} 216 217atf_test_case bectl_export_import cleanup --- 228 unchanged lines hidden --- |