Skip to content

Commit

Permalink
test: test create layer from staging directory
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Sep 19, 2023
1 parent be12e5b commit 027416c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/apply-diff.bats
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,46 @@ load helpers
checkchanges
checkdiffs
}

@test "apply-diff-from-staging-directory" {
case "$STORAGE_DRIVER" in
overlay*)
;;
*)
skip "driver $STORAGE_DRIVER does not support diff-from-staging-directory"
;;
esac

SRC=$TESTDIR/source
mkdir -p $SRC
createrandom $SRC/file1
createrandom $SRC/file2
createrandom $SRC/file3

# Create a layer.
run storage --debug=false create-layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
layer="$output"

run storage --debug=false applydiff-using-staging-dir $layer $SRC
cat <<< $output
[ "$status" -eq 0 ]

name=safe-image
run storage --debug=false create-image --name $name $layer
[ "$status" -eq 0 ]

ctrname=foo
run storage --debug=false create-container --name $ctrname $name
[ "$status" -eq 0 ]

run storage --debug=false mount $ctrname
[ "$status" -eq 0 ]
mount="$output"

for i in file1 file2 file3 ; do
run cmp $SRC/$i $mount/$i
[ "$status" -eq 0 ]
done
}

0 comments on commit 027416c

Please sign in to comment.