tests: check that we update last-writers when changing things
Make sure that the appropriate lock file's contents (the last-writer ID) actually gets updated when we create layers, images, and containers. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
parent
a97b757f6a
commit
9a4328ef7c
|
|
@ -40,6 +40,9 @@ load helpers
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
firstcontainer=${output%% *}
|
firstcontainer=${output%% *}
|
||||||
|
|
||||||
|
firstwriter=$(cat ${TESTDIR}/root/${STORAGE_DRIVER}-containers/containers.lock)
|
||||||
|
[ "$firstwriter" != "" ]
|
||||||
|
|
||||||
# Check that the container can be found.
|
# Check that the container can be found.
|
||||||
storage exists -c $firstcontainer
|
storage exists -c $firstcontainer
|
||||||
|
|
||||||
|
|
@ -49,6 +52,10 @@ load helpers
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
secondcontainer=${output%% *}
|
secondcontainer=${output%% *}
|
||||||
|
|
||||||
|
secondwriter=$(cat ${TESTDIR}/root/${STORAGE_DRIVER}-containers/containers.lock)
|
||||||
|
[ "$secondwriter" != "" ]
|
||||||
|
[ "$firstwriter" != "$secondwriter" ]
|
||||||
|
|
||||||
# Check that *that* container can be found.
|
# Check that *that* container can be found.
|
||||||
storage exists -c $secondcontainer
|
storage exists -c $secondcontainer
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ load helpers
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
zerothimage=${output%% *}
|
zerothimage=${output%% *}
|
||||||
|
|
||||||
|
zerothwriter=$(cat ${TESTDIR}/root/${STORAGE_DRIVER}-images/images.lock)
|
||||||
|
[ "$zerothwriter" != "" ]
|
||||||
|
|
||||||
# Create a layer.
|
# Create a layer.
|
||||||
run storage --debug=false create-layer
|
run storage --debug=false create-layer
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
@ -21,6 +24,10 @@ load helpers
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
firstimage=${output%% *}
|
firstimage=${output%% *}
|
||||||
|
|
||||||
|
firstwriter=$(cat ${TESTDIR}/root/${STORAGE_DRIVER}-images/images.lock)
|
||||||
|
[ "$firstwriter" != "" ]
|
||||||
|
[ "$zerothwriter" != "$firstwriter" ]
|
||||||
|
|
||||||
# Check that the image can be accessed.
|
# Check that the image can be accessed.
|
||||||
storage exists -i $firstimage
|
storage exists -i $firstimage
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,15 @@ load helpers
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
lowerlayer="$output"
|
lowerlayer="$output"
|
||||||
|
lowerwriter=$(cat ${TESTDIR}/root/${STORAGE_DRIVER}-layers/layers.lock)
|
||||||
|
[ "$lowerwriter" != "" ]
|
||||||
# Mount the layer.
|
# Mount the layer.
|
||||||
run storage --debug=false mount $lowerlayer
|
run storage --debug=false mount $lowerlayer
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
lowermount="$output"
|
lowermount="$output"
|
||||||
|
lowermwriter=$(cat ${TESTDIR}/runroot/${STORAGE_DRIVER}-layers/mountpoints.lock)
|
||||||
|
[ "$lowermwriter" != "" ]
|
||||||
# Put a file in the layer.
|
# Put a file in the layer.
|
||||||
createrandom "$lowermount"/layer1file1
|
createrandom "$lowermount"/layer1file1
|
||||||
|
|
||||||
|
|
@ -21,11 +25,15 @@ load helpers
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
midlayer="$output"
|
midlayer="$output"
|
||||||
|
midwriter=$(cat ${TESTDIR}/root/${STORAGE_DRIVER}-layers/layers.lock)
|
||||||
|
[ "$midwriter" != "" ]
|
||||||
# Mount that layer, too.
|
# Mount that layer, too.
|
||||||
run storage --debug=false mount $midlayer
|
run storage --debug=false mount $midlayer
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
midmount="$output"
|
midmount="$output"
|
||||||
|
midmwriter=$(cat ${TESTDIR}/runroot/${STORAGE_DRIVER}-layers/mountpoints.lock)
|
||||||
|
[ "$midmwriter" != "" ]
|
||||||
# Check that the file from the first layer is there.
|
# Check that the file from the first layer is there.
|
||||||
test -s "$midmount"/layer1file1
|
test -s "$midmount"/layer1file1
|
||||||
# Check that we can remove it...
|
# Check that we can remove it...
|
||||||
|
|
@ -44,11 +52,15 @@ load helpers
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
upperlayer="$output"
|
upperlayer="$output"
|
||||||
|
upperwriter=$(cat ${TESTDIR}/root/${STORAGE_DRIVER}-layers/layers.lock)
|
||||||
|
[ "$upperwriter" != "" ]
|
||||||
# Mount this layer.
|
# Mount this layer.
|
||||||
run storage --debug=false mount $upperlayer
|
run storage --debug=false mount $upperlayer
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" != "" ]
|
[ "$output" != "" ]
|
||||||
uppermount="$output"
|
uppermount="$output"
|
||||||
|
uppermwriter=$(cat ${TESTDIR}/runroot/${STORAGE_DRIVER}-layers/mountpoints.lock)
|
||||||
|
[ "$uppermwriter" != "" ]
|
||||||
# Check that the file we removed from the second layer is still gone.
|
# Check that the file we removed from the second layer is still gone.
|
||||||
run test -s "$uppermount"/layer1file1
|
run test -s "$uppermount"/layer1file1
|
||||||
[ "$status" -ne 0 ]
|
[ "$status" -ne 0 ]
|
||||||
|
|
@ -68,4 +80,14 @@ load helpers
|
||||||
[ "${lines[0]}" = "$lowerlayer" ] || [ "${lines[0]}" = "$midlayer" ] || [ "${lines[0]}" = "$upperlayer" ]
|
[ "${lines[0]}" = "$lowerlayer" ] || [ "${lines[0]}" = "$midlayer" ] || [ "${lines[0]}" = "$upperlayer" ]
|
||||||
[ "${lines[1]}" = "$lowerlayer" ] || [ "${lines[1]}" = "$midlayer" ] || [ "${lines[1]}" = "$upperlayer" ]
|
[ "${lines[1]}" = "$lowerlayer" ] || [ "${lines[1]}" = "$midlayer" ] || [ "${lines[1]}" = "$upperlayer" ]
|
||||||
[ "${lines[2]}" = "$lowerlayer" ] || [ "${lines[2]}" = "$midlayer" ] || [ "${lines[2]}" = "$upperlayer" ]
|
[ "${lines[2]}" = "$lowerlayer" ] || [ "${lines[2]}" = "$midlayer" ] || [ "${lines[2]}" = "$upperlayer" ]
|
||||||
|
|
||||||
|
# Check that we updated the layers last-writer consistently.
|
||||||
|
[ "${lowerwriter}" != "${midwriter}" ]
|
||||||
|
[ "${lowerwriter}" != "${upperwriter}" ]
|
||||||
|
[ "${midwriter}" != "${upperwriter}" ]
|
||||||
|
|
||||||
|
# Check that we updated the mountpoints last-writer consistently.
|
||||||
|
[ "${lowermwriter}" != "${midmwriter}" ]
|
||||||
|
[ "${lowermwriter}" != "${uppermwriter}" ]
|
||||||
|
[ "${midmwriter}" != "${uppermwriter}" ]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue