File: root.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 (51 lines) | stat: -rw-r--r-- 1,134 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
#!/usr/bin/env bats

load helpers

function setup() {
	setup_busybox
	ALT_ROOT="$ROOT/alt"
	mkdir -p "$ALT_ROOT/state"
}

function teardown() {
	ROOT=$ALT_ROOT __runc delete -f test_dotbox
	unset ALT_ROOT
	teardown_bundle
}

@test "global --root" {
	# run busybox detached using $ALT_ROOT for state
	ROOT=$ALT_ROOT runc run -d --console-socket "$CONSOLE_SOCKET" test_dotbox
	[ "$status" -eq 0 ]

	# run busybox detached in default root
	runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
	[ "$status" -eq 0 ]

	runc state test_busybox
	[ "$status" -eq 0 ]
	[[ "${output}" == *"running"* ]]

	ROOT=$ALT_ROOT runc state test_dotbox
	[ "$status" -eq 0 ]
	[[ "${output}" == *"running"* ]]

	ROOT=$ALT_ROOT runc state test_busybox
	[ "$status" -ne 0 ]

	runc state test_dotbox
	[ "$status" -ne 0 ]

	runc kill test_busybox KILL
	[ "$status" -eq 0 ]
	wait_for_container 10 1 test_busybox stopped
	runc delete test_busybox
	[ "$status" -eq 0 ]

	ROOT=$ALT_ROOT runc kill test_dotbox KILL
	[ "$status" -eq 0 ]
	ROOT=$ALT_ROOT wait_for_container 10 1 test_dotbox stopped
	ROOT=$ALT_ROOT runc delete test_dotbox
	[ "$status" -eq 0 ]
}