...
1#!/usr/bin/env bats
2
3load helpers
4
5function setup() {
6 setup_busybox
7}
8
9function teardown() {
10 teardown_bundle
11}
12
13@test "runc pause and resume" {
14 if [[ "$ROOTLESS" -ne 0 ]]; then
15 requires rootless_cgroup
16 set_cgroups_path
17 fi
18 requires cgroups_freezer
19
20 # run busybox detached
21 runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
22 [ "$status" -eq 0 ]
23
24 testcontainer test_busybox running
25
26 # pause busybox
27 runc pause test_busybox
28 [ "$status" -eq 0 ]
29
30 # test state of busybox is paused
31 testcontainer test_busybox paused
32
33 # resume busybox
34 runc resume test_busybox
35 [ "$status" -eq 0 ]
36
37 # test state of busybox is back to running
38 testcontainer test_busybox running
39}
40
41@test "runc pause and resume with nonexist container" {
42 if [[ "$ROOTLESS" -ne 0 ]]; then
43 requires rootless_cgroup
44 set_cgroups_path
45 fi
46 requires cgroups_freezer
47
48 # run test_busybox detached
49 runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
50 [ "$status" -eq 0 ]
51
52 testcontainer test_busybox running
53
54 # pause test_busybox and nonexistent container
55 runc pause test_busybox
56 [ "$status" -eq 0 ]
57 runc pause nonexistent
58 [ "$status" -ne 0 ]
59
60 # test state of test_busybox is paused
61 testcontainer test_busybox paused
62
63 # resume test_busybox and nonexistent container
64 runc resume test_busybox
65 [ "$status" -eq 0 ]
66 runc resume nonexistent
67 [ "$status" -ne 0 ]
68
69 # test state of test_busybox is back to running
70 testcontainer test_busybox running
71
72 # delete test_busybox
73 runc delete --force test_busybox
74
75 runc state test_busybox
76 [ "$status" -ne 0 ]
77}
View as plain text