File: help.bats

package info (click to toggle)
runc 1.3.3%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 3,136 kB
  • sloc: sh: 2,298; ansic: 1,125; makefile: 229
file content (94 lines) | stat: -rw-r--r-- 1,916 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env bats

load helpers

function setup() {
	# It does not make sense to repeat these trivial tests for non-root.
	# Also, they fail due to $ROOT not being set and XDG_RUNTIME_DIR
	# pointing to another user's directory after sudo rootless.
	requires root
}

@test "runc -h" {
	runc -h
	[ "$status" -eq 0 ]
	[[ ${lines[0]} =~ NAME:+ ]]
	[[ ${lines[1]} =~ runc\ '-'\ Open\ Container\ Initiative\ runtime+ ]]

	runc --help
	[ "$status" -eq 0 ]
	[[ ${lines[0]} =~ NAME:+ ]]
	[[ ${lines[1]} =~ runc\ '-'\ Open\ Container\ Initiative\ runtime+ ]]
}

@test "runc command -h" {
	runc checkpoint -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ checkpoint+ ]]

	runc delete -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ delete+ ]]

	runc events -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ events+ ]]

	runc exec -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ exec+ ]]

	runc kill -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ kill+ ]]

	runc list -h
	[ "$status" -eq 0 ]
	[[ ${lines[0]} =~ NAME:+ ]]
	[[ ${lines[1]} =~ runc\ list+ ]]

	runc list --help
	[ "$status" -eq 0 ]
	[[ ${lines[0]} =~ NAME:+ ]]
	[[ ${lines[1]} =~ runc\ list+ ]]

	runc pause -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ pause+ ]]

	runc restore -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ restore+ ]]

	runc resume -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ resume+ ]]

	# We don't use runc_spec here, because we're just testing the help page.
	runc spec -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ spec+ ]]

	runc start -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ start+ ]]

	runc run -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ run+ ]]

	runc state -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ state+ ]]

	runc update -h
	[ "$status" -eq 0 ]
	[[ ${lines[1]} =~ runc\ update+ ]]

}

@test "runc foo -h" {
	runc foo -h
	[ "$status" -ne 0 ]
	[[ "${output}" == *"No help topic for 'foo'"* ]]
}