Skip to content

Commit e72a4e5

Browse files
committed
[integration] add testcases for runc delete command
this patch add two testcases for the `runc delete` with multi-containers. see : #1053 Signed-off-by: Wang Long <[email protected]>
1 parent e83ccf6 commit e72a4e5

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

tests/integration/delete.bats

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,62 @@ function teardown() {
4848
runc state test_busybox
4949
[ "$status" -ne 0 ]
5050
}
51+
52+
@test "run delete with multi-containers" {
53+
# create busybox1 detached
54+
runc create --console /dev/pts/ptmx test_busybox1
55+
[ "$status" -eq 0 ]
56+
57+
testcontainer test_busybox1 created
58+
59+
# run busybox2 detached
60+
runc run -d --console /dev/pts/ptmx test_busybox2
61+
[ "$status" -eq 0 ]
62+
63+
wait_for_container 15 1 test_busybox2
64+
testcontainer test_busybox2 running
65+
66+
# delete both test_busybox1 and test_busybox2 container
67+
runc delete test_busybox1 test_busybox2
68+
69+
runc state test_busybox1
70+
[ "$status" -ne 0 ]
71+
72+
runc state test_busybox2
73+
[ "$status" -eq 0 ]
74+
75+
runc kill test_busybox2 KILL
76+
# wait for busybox2 to be in the destroyed state
77+
retry 10 1 eval "__runc state test_busybox2 | grep -q 'stopped'"
78+
79+
# delete test_busybox2
80+
runc delete test_busybox2
81+
82+
runc state test_busybox2
83+
[ "$status" -ne 0 ]
84+
}
85+
86+
87+
@test "run delete --force with multi-containers" {
88+
# create busybox1 detached
89+
runc create --console /dev/pts/ptmx test_busybox1
90+
[ "$status" -eq 0 ]
91+
92+
testcontainer test_busybox1 created
93+
94+
# run busybox2 detached
95+
runc run -d --console /dev/pts/ptmx test_busybox2
96+
[ "$status" -eq 0 ]
97+
98+
wait_for_container 15 1 test_busybox2
99+
testcontainer test_busybox2 running
100+
101+
# delete both test_busybox1 and test_busybox2 container
102+
runc delete --force test_busybox1 test_busybox2
103+
104+
runc state test_busybox1
105+
[ "$status" -ne 0 ]
106+
107+
runc state test_busybox2
108+
[ "$status" -ne 0 ]
109+
}

0 commit comments

Comments
 (0)