From f6a3af4a100c509a469f4dd55b0cbf97e4be5baf Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 29 Jul 2020 11:11:33 +0000 Subject: [PATCH] Add a check for correct metrics in smoke-test --- test/101_cross_hosts_2_test.sh | 1 + test/config.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/test/101_cross_hosts_2_test.sh b/test/101_cross_hosts_2_test.sh index 70039b2b..bc345eaa 100755 --- a/test/101_cross_hosts_2_test.sh +++ b/test/101_cross_hosts_2_test.sh @@ -24,5 +24,6 @@ weave_on $HOST2 attach $C2/24 c2 wait_for_x network_tester_status "network tester status" assert "echo $status" "pass" +assert "connections_metric $HOST1 state=\\\"established\\\"" "1" end_suite diff --git a/test/config.sh b/test/config.sh index 29958867..fd239b10 100644 --- a/test/config.sh +++ b/test/config.sh @@ -267,6 +267,10 @@ wait_for_attached() { wait_for_x "check_attached $1 $2" "$2 on $1 to be attached" } +connections_metric() { + $SSH $1 curl -sS http://127.0.0.1:6784/metrics | awk -e "/^weave_connections.*$2/ { print \$2 }" +} + # assert_dns_record [ ...] assert_dns_record() { local host=$1