...
1#!/usr/bin/env bats
2
3load helpers
4
5@test "runc -h" {
6 runc -h
7 [ "$status" -eq 0 ]
8 [[ ${lines[0]} =~ NAME:+ ]]
9 [[ ${lines[1]} =~ runc\ '-'\ Open\ Container\ Initiative\ runtime+ ]]
10
11 runc --help
12 [ "$status" -eq 0 ]
13 [[ ${lines[0]} =~ NAME:+ ]]
14 [[ ${lines[1]} =~ runc\ '-'\ Open\ Container\ Initiative\ runtime+ ]]
15}
16
17@test "runc command -h" {
18 runc checkpoint -h
19 [ "$status" -eq 0 ]
20 [[ ${lines[1]} =~ runc\ checkpoint+ ]]
21
22 runc delete -h
23 [ "$status" -eq 0 ]
24 [[ ${lines[1]} =~ runc\ delete+ ]]
25
26 runc events -h
27 [ "$status" -eq 0 ]
28 [[ ${lines[1]} =~ runc\ events+ ]]
29
30 runc exec -h
31 [ "$status" -eq 0 ]
32 [[ ${lines[1]} =~ runc\ exec+ ]]
33
34 runc kill -h
35 [ "$status" -eq 0 ]
36 [[ ${lines[1]} =~ runc\ kill+ ]]
37
38 runc list -h
39 [ "$status" -eq 0 ]
40 [[ ${lines[0]} =~ NAME:+ ]]
41 [[ ${lines[1]} =~ runc\ list+ ]]
42
43 runc list --help
44 [ "$status" -eq 0 ]
45 [[ ${lines[0]} =~ NAME:+ ]]
46 [[ ${lines[1]} =~ runc\ list+ ]]
47
48 runc pause -h
49 [ "$status" -eq 0 ]
50 [[ ${lines[1]} =~ runc\ pause+ ]]
51
52 runc restore -h
53 [ "$status" -eq 0 ]
54 [[ ${lines[1]} =~ runc\ restore+ ]]
55
56 runc resume -h
57 [ "$status" -eq 0 ]
58 [[ ${lines[1]} =~ runc\ resume+ ]]
59
60 # We don't use runc_spec here, because we're just testing the help page.
61 runc spec -h
62 [ "$status" -eq 0 ]
63 [[ ${lines[1]} =~ runc\ spec+ ]]
64
65 runc start -h
66 [ "$status" -eq 0 ]
67 [[ ${lines[1]} =~ runc\ start+ ]]
68
69 runc run -h
70 [ "$status" -eq 0 ]
71 [[ ${lines[1]} =~ runc\ run+ ]]
72
73 runc state -h
74 [ "$status" -eq 0 ]
75 [[ ${lines[1]} =~ runc\ state+ ]]
76
77 runc update -h
78 [ "$status" -eq 0 ]
79 [[ ${lines[1]} =~ runc\ update+ ]]
80
81}
82
83@test "runc foo -h" {
84 runc foo -h
85 [ "$status" -ne 0 ]
86 [[ "${output}" == *"No help topic for 'foo'"* ]]
87}
View as plain text