Merge pull request #3789 from hairyhenderson/add-connection-type-label-to-weave-connection-metric-3788

Add new 'type' and 'encryption' labels to weave_connections metric
This commit is contained in:
Bryan Boreham authored and GitHub committed 2020-08-03 11:40:16 +01:00
commit 4592758e48
6 files changed
+31 -6

No files matched your search

+1
View File
@@ -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 encryption=\\\"\\\",state=\\\"established\\\"" "1"
end_suite
+1
View File
@@ -16,5 +16,6 @@ assert_raises "exec_on $HOST1 c1 $PING $C2"
assert_raises "weave_on $HOST1 status connections | grep -P 'encrypted *sleeve'"
assert_raises "weave_on $HOST2 status connections | grep -P 'encrypted *sleeve'"
assert "connections_metric $HOST1 encryption=\\\"yes\\\"",state=\\\"established\\\" "1"
end_suite
+1
View File
@@ -44,6 +44,7 @@ weave_on $HOST2 launch --password wfvAwt7sj $HOST1
assert_raises "weave_on $HOST1 status connections | grep -P 'encrypted *fastdp'"
assert_raises "weave_on $HOST2 status connections | grep -P 'encrypted *fastdp'"
assert "connections_metric $HOST1 encryption=\\\"yes\\\"",state=\\\"established\\\" "1"
PCAP1=$(mktemp)
PCAP2=$(mktemp)
+2
View File
@@ -17,6 +17,7 @@ weave_on $HOST1 launch --password wfvAwt7sj --trusted-subnets $HOST2_CIDR
weave_on $HOST2 launch --password wfvAwt7sj $HOST1
assert_raises "weave_on $HOST1 status connections | grep encrypted"
assert_raises "weave_on $HOST2 status connections | grep encrypted"
assert "connections_metric $HOST1 encryption=\\\"yes\\\"",state=\\\"established\\\" "1"
weave_on $HOST1 stop
weave_on $HOST2 stop
@@ -26,5 +27,6 @@ weave_on $HOST1 launch --password wfvAwt7sj --trusted-subnets $HOST2_CIDR
weave_on $HOST2 launch --password wfvAwt7sj --trusted-subnets $HOST1_CIDR $HOST1
assert_raises "weave_on $HOST1 status connections | grep unencrypted"
assert_raises "weave_on $HOST2 status connections | grep unencrypted"
assert "connections_metric $HOST1 encryption=\\\"\\\"",state=\\\"established\\\" "1"
end_suite
+4
View File
@@ -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 <host> <container> <name> [<ip> ...]
assert_dns_record() {
local host=$1