Skip to content

Commit 45c30e7

Browse files
Merge pull request #784 from hqhq/hq_ps_following_up
Add integration test for ps command
2 parents 2ad2cf7 + 98afb73 commit 45c30e7

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

tests/integration/ps.bats

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function teardown() {
1111
teardown_busybox
1212
}
1313

14-
@test "ps -eaf" {
14+
@test "ps" {
1515
# start busybox detached
1616
runc run -d --console /dev/pts/ptmx test_busybox
1717
[ "$status" -eq 0 ]
@@ -21,8 +21,39 @@ function teardown() {
2121

2222
testcontainer test_busybox running
2323

24-
runc ps test_busybox -eaf
24+
runc ps test_busybox
2525
[ "$status" -eq 0 ]
2626
[[ ${lines[0]} =~ UID\ +PID\ +PPID\ +C\ +STIME\ +TTY\ +TIME\ +CMD+ ]]
2727
[[ "${lines[1]}" == *"root"*[0-9]* ]]
2828
}
29+
30+
@test "ps -f json" {
31+
# start busybox detached
32+
runc run -d --console /dev/pts/ptmx test_busybox
33+
[ "$status" -eq 0 ]
34+
35+
# check state
36+
wait_for_container 15 1 test_busybox
37+
38+
testcontainer test_busybox running
39+
40+
runc ps -f json test_busybox
41+
[ "$status" -eq 0 ]
42+
[[ ${lines[0]} =~ [0-9]+ ]]
43+
}
44+
45+
@test "ps -e -x" {
46+
# start busybox detached
47+
runc run -d --console /dev/pts/ptmx test_busybox
48+
[ "$status" -eq 0 ]
49+
50+
# check state
51+
wait_for_container 15 1 test_busybox
52+
53+
testcontainer test_busybox running
54+
55+
runc ps test_busybox -e -x
56+
[ "$status" -eq 0 ]
57+
[[ ${lines[0]} =~ \ +PID\ +TTY\ +STAT\ +TIME\ +COMMAND+ ]]
58+
[[ "${lines[1]}" =~ [0-9]+ ]]
59+
}

0 commit comments

Comments
 (0)