From c8096dd06c92aeb9a95fb9e2134f72d8cd198c73 Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Sat, 30 Jul 2016 14:01:36 +0200 Subject: Only show number of running containers when there are any --- include/tests_containers | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/tests_containers') diff --git a/include/tests_containers b/include/tests_containers index c32a59d0..11764afe 100644 --- a/include/tests_containers +++ b/include/tests_containers @@ -139,7 +139,7 @@ DOCKER_CONTAINERS_TOTAL=0 fi LogText "Result: docker info shows ${DOCKER_CONTAINERS_TOTAL} containers" - DOCKER_CONTAINERS_TOTAL2=`${DOCKERBINARY} ps -a 2> /dev/null | grep -v "CONTAINER" | wc -l` + DOCKER_CONTAINERS_TOTAL2=$(${DOCKERBINARY} ps -a 2> /dev/null | grep -c -v "CONTAINER") LogText "Result: docker ps -a shows ${DOCKER_CONTAINERS_TOTAL2} containers" if [ ! "${DOCKER_CONTAINERS_TOTAL}" = "${DOCKER_CONTAINERS_TOTAL2}" ]; then LogText "Result: difference detected, which is unexpected" @@ -150,9 +150,9 @@ fi # Check running instances - DOCKER_CONTAINERS_RUNNING=`${DOCKERBINARY} ps 2> /dev/null | grep -v "CONTAINER" | wc -l` - Display --indent 8 --text "- Running containers" --result "${DOCKER_CONTAINERS_RUNNING}" --color GREEN + DOCKER_CONTAINERS_RUNNING=$(${DOCKERBINARY} ps 2> /dev/null | grep -c -v "CONTAINER") if [ ${DOCKER_CONTAINERS_RUNNING} -gt 0 ]; then + Display --indent 10 --text "- Running containers" --result "${DOCKER_CONTAINERS_RUNNING}" --color GREEN LogText "Result: ${DOCKER_CONTAINERS_RUNNING} containers are currently active" Report "docker_containers_running=${DOCKER_CONTAINERS_RUNNING}" else -- cgit v1.2.3