If the machine coordinating the test runs does not have jq, then test #175 fails with: > test #1 "weave_on test-0.lon1.weave-net report | jq -r '.Router.Targets[] | tostring' | sort" failed: > expected "test-1.lon1.weave-net > test-2.lon1.weave-net" > got nothing This change completely removes the dependency on jq to make the test more robust and avoid potential confusion.
37 lines
993 B
Bash
Executable File
37 lines
993 B
Bash
Executable File
#! /bin/bash
|
|
|
|
. "$(dirname "$0")/config.sh"
|
|
|
|
|
|
assert_targets() {
|
|
HOST=$1
|
|
shift
|
|
EXPECTED=$(for TARGET in $@; do echo $TARGET; done | sort)
|
|
assert "weave_on $HOST report -f '{{range .Router.Targets}}{{.}}{{\"\n\"}}{{end}}' | sort" "$EXPECTED"
|
|
}
|
|
|
|
start_suite "Check Docker restart uses persisted peer list"
|
|
|
|
# Launch router and modify initial peer list
|
|
weave_on $HOST1 launch $HOST1 $HOST2
|
|
weave_on $HOST1 forget $HOST1
|
|
weave_on $HOST1 connect $HOST3
|
|
|
|
# Ensure modified peer list is still in effect after restart
|
|
check_restart $HOST1 weave
|
|
assert_targets $HOST1 $HOST2 $HOST3
|
|
|
|
# Ensure persisted peer changes are still in effect after --resume
|
|
weave_on $HOST1 stop
|
|
weave_on $HOST1 launch --resume
|
|
assert_targets $HOST1 $HOST2 $HOST3
|
|
|
|
# Ensure persisted peer changes are ignored after stop and subsequent restart
|
|
weave_on $HOST1 stop
|
|
weave_on $HOST1 launch $HOST1 $HOST2
|
|
assert_targets $HOST1 $HOST1 $HOST2
|
|
check_restart $HOST1 weave
|
|
assert_targets $HOST1 $HOST1 $HOST2
|
|
|
|
end_suite
|