File: apply-junk.bats

package info (click to toggle)
golang-github-containers-storage 1.50.2%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,032 kB
  • sloc: sh: 641; ansic: 388; makefile: 140; awk: 12
file content (47 lines) | stat: -rw-r--r-- 1,032 bytes parent folder | download | duplicates (3)
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
}