From f7e42c0b307a8f6b45047705a98224ae191ab068 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 17 Jul 2024 22:59:42 -0400 Subject: [PATCH] tests/container-copy: test refreshing the copy Signed-off-by: Simon Deziel --- tests/container-copy | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/container-copy b/tests/container-copy index 2411d2f2a..fa254047a 100755 --- a/tests/container-copy +++ b/tests/container-copy @@ -47,6 +47,23 @@ for fs in "xfs" "btrfs" "ext4" ; do # Copy the container to the remote LXD. lxc copy c1 target:c1 --stateless --refresh --mode=relay + # Test refreshing the copy + lxc start target:c1 + printf "%s" "${fs}" | lxc file push - c1/root/my-fs + ! lxc exec target:c1 -- test -e /root/my-fs || false + lxc stop -f target:c1 + lxc copy c1 target:c1 --stateless --refresh --mode=relay + lxc start target:c1 + [ "$(lxc exec target:c1 -- cat /root/my-fs)" = "${fs}" ] + lxc stop -f target:c1 + + # Test appending to a file before refreshing the copy + echo "-${$}" | lxc exec c1 -- tee -a /root/my-fs + lxc copy c1 target:c1 --stateless --refresh --mode=relay + lxc start target:c1 + [ "$(lxc exec target:c1 -- cat /root/my-fs)" = "${fs}-${$}" ] + lxc stop -f target:c1 + # Clean up the storage pool for this run. lxc delete c1 -f lxc delete target:c1 -f