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
|
#!/usr/bin/env bats
load helpers
function applyjunk_main() {
# Create and try to populate layers with... garbage. It should be
# rejected cleanly.
compressed="$1"
storage create-layer --id layer-${compressed}
echo [[${compressed} /etc/os-release]]
if ! ${compressed} < /etc/os-release > junkfile ; then
skip "error running ${compressed}"
fi
run storage apply-diff --file junkfile layer-${compressed}
echo "$output"
[[ "$status" -ne 0 ]]
[[ "$output" =~ "invalid tar header" ]] || [[ "$output" =~ "unexpected EOF" ]]
echo [[${compressed}]]
echo "sorry, not even enough info for a tar header here" | ${compressed} > junkfile
run storage apply-diff --file junkfile layer-${compressed}
echo "$output"
[[ "$status" -ne 0 ]]
[[ "$output" =~ "unexpected EOF" ]]
}
@test "applyjunk-uncompressed" {
applyjunk_main cat
}
@test "applyjunk-gzip" {
applyjunk_main gzip
}
@test "applyjunk-bzip2" {
applyjunk_main bzip2
}
@test "applyjunk-xz" {
applyjunk_main xz
}
@test "applyjunk-zstd" {
applyjunk_main zstd
}
|