1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#!/usr/bin/env bats
load helpers
@test "delete-container" {
# Create a layer.
run storage --debug=false create-layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
layer=$output
# Create an image using that layer.
run storage --debug=false create-image $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
image=${output%% *}
# Create an image using that layer.
run storage --debug=false create-container $image
[ "$status" -eq 0 ]
[ "$output" != "" ]
container=${output%% *}
# Check that the container can be found.
storage exists -c $container
# Use delete-container to delete it.
storage delete-container $container
# Check that the container is gone.
run storage exists -c $container
[ "$status" -ne 0 ]
}
@test "delete-container-with-immutable" {
if [ "$OS" != "FreeBSD" ]; then
skip "not supported on $OS"
fi
# Create a layer.
run storage --debug=false create-layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
layer=$output
# Create an image using that layer.
run storage --debug=false create-image $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
image=${output%% *}
# Create an image using that layer.
run storage --debug=false create-container $image
[ "$status" -eq 0 ]
[ "$output" != "" ]
container=${output%% *}
# Check that the container can be found.
storage exists -c $container
run storage --debug=false mount $container
[ "$status" -eq 0 ]
[ "$output" != "" ]
containermount="$output"
# Create a file and make it immutable
createrandom "$containermount"/file1
chflags schg "$containermount"/file1
run storage --debug=false unmount $container
[ "$status" -eq 0 ]
[ "$output" != "" ]
# Use delete-container to delete it.
storage delete-container $container
# Check that the container is gone.
run storage exists -c $container
[ "$status" -ne 0 ]
}
|