Make container_pid a common test function
This commit is contained in:
1 parent
a66543f98e
commit
4e09889cab
2 files changed
+6
-6
No files matched your search
@@ -4,17 +4,13 @@
|
|||||||
|
|
||||||
start_suite "Test docker restart policy"
|
start_suite "Test docker restart policy"
|
||||||
|
|
||||||
pidof() {
|
|
||||||
docker_on $1 inspect -f '{{.State.Pid}}' $2
|
|
||||||
}
|
|
||||||
|
|
||||||
check_restart() {
|
check_restart() {
|
||||||
OLD_PID=$(pidof $1 $2)
|
OLD_PID=$(container_pid $1 $2)
|
||||||
|
|
||||||
run_on $1 sudo kill $OLD_PID
|
run_on $1 sudo kill $OLD_PID
|
||||||
|
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
NEW_PID=$(pidof $1 $2)
|
NEW_PID=$(container_pid $1 $2)
|
||||||
|
|
||||||
if [ $NEW_PID != 0 -a $NEW_PID != $OLD_PID ] ; then
|
if [ $NEW_PID != 0 -a $NEW_PID != $OLD_PID ] ; then
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -183,6 +183,10 @@ container_ip() {
|
|||||||
weave_on $1 ps $2 | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
|
weave_on $1 ps $2 | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
container_pid() {
|
||||||
|
docker_on $1 inspect -f '{{.State.Pid}}' $2
|
||||||
|
}
|
||||||
|
|
||||||
# assert_dns_record <host> <container> <name> [<ip> ...]
|
# assert_dns_record <host> <container> <name> [<ip> ...]
|
||||||
assert_dns_record() {
|
assert_dns_record() {
|
||||||
local host=$1
|
local host=$1
|
||||||
|
|||||||
Reference in new issue
Block a user