Merge pull request #219 from konstruktoid/swarm_tests

update swarm tests
This commit is contained in:
Thomas Sjögren 2017-02-22 10:13:15 +01:00 committed by GitHub
commit 1caa7f4344

View file

@ -130,7 +130,7 @@ check_2_14="2.14 - Enable live restore"
if docker info 2>/dev/null | grep -e "Live Restore Enabled:\s*true\s*" >/dev/null 2>&1; then if docker info 2>/dev/null | grep -e "Live Restore Enabled:\s*true\s*" >/dev/null 2>&1; then
pass "$check_2_14" pass "$check_2_14"
else else
if docker info 2>/dev/null | grep -e "Swarm:\s*active\s*" >/dev/null 2>&1; then if docker info 2>/dev/null | grep -e "Swarm:*\sactive\s*" >/dev/null 2>&1; then
pass "$check_2_14 (Incompatible with swarm mode)" pass "$check_2_14 (Incompatible with swarm mode)"
else else
warn "$check_2_14" warn "$check_2_14"
@ -139,7 +139,7 @@ fi
# 2.15 # 2.15
check_2_15="2.15 - Do not enable swarm mode, if not needed" check_2_15="2.15 - Do not enable swarm mode, if not needed"
if docker info 2>/dev/null | grep -e "Swarm:\s*active\s*" >/dev/null 2>&1; then if docker info 2>/dev/null | grep -e "Swarm:*\sinactive\s*" >/dev/null 2>&1; then
pass "$check_2_15" pass "$check_2_15"
else else
warn "$check_2_15" warn "$check_2_15"
@ -147,7 +147,7 @@ fi
# 2.16 # 2.16
check_2_16="2.16 - Control the number of manager nodes in a swarm" check_2_16="2.16 - Control the number of manager nodes in a swarm"
if docker info 2>/dev/null | grep -e "Swarm:\s*active\s*" >/dev/null 2>&1; then if docker info 2>/dev/null | grep -e "Swarm:*\sactive\s*" >/dev/null 2>&1; then
managernodes=$(docker node ls | grep -c "Leader") managernodes=$(docker node ls | grep -c "Leader")
if [ "$managernodes" -le 1 ]; then if [ "$managernodes" -le 1 ]; then
pass "$check_2_16" pass "$check_2_16"
@ -160,11 +160,15 @@ fi
# 2.17 # 2.17
check_2_17="2.17 - Bind swarm services to a specific host interface" check_2_17="2.17 - Bind swarm services to a specific host interface"
netstat -lt | grep -e '\[::]:2377' -e '*:2377' -e '0.0.0.0:2377' >/dev/null 2>&1 if docker info 2>/dev/null | grep -e "Swarm:*\sactive\s*" >/dev/null 2>&1; then
if [ $? -eq 1 ]; then netstat -lt | grep -e '\[::]:2377' -e '*:2377' -e '0.0.0.0:2377' >/dev/null 2>&1
if [ $? -eq 1 ]; then
pass "$check_2_17" pass "$check_2_17"
else else
warn "$check_2_17" warn "$check_2_17"
fi
else
pass "$check_2_17 (Swarm mode not enabled)"
fi fi
# 2.18 # 2.18