File: help.bats

package info (click to toggle)
runc 1.0.0~rc6%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,972 kB
  • sloc: sh: 1,386; ansic: 946; makefile: 117
file content (87 lines) | stat: -rw-r--r-- 1,741 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
#!/usr/bin/env bats

load helpers

@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'"* ]]
}