Skip to content

Commit

Permalink
[CONSUL-466] Review case-grpc Failing Test (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
joselo85 committed Dec 21, 2022
1 parent 0a01500 commit 80bfa8d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 47 deletions.
48 changes: 24 additions & 24 deletions test/integration/connect/envoy/case-grpc/service_s1.hcl
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
services {
name = "s1"
port = 8079
connect {
sidecar_service {
proxy {
upstreams = [
{
destination_name = "s2"
local_bind_port = 5000
config {
protocol = "grpc"
}
}
]
config {
protocol = "grpc"
envoy_dogstatsd_url = "udp://127.0.0.1:8125"
envoy_stats_tags = ["foo=bar"]
envoy_stats_flush_interval = "1s"
}
}
}
}
services {
name = "s1"
port = 8079
connect {
sidecar_service {
proxy {
upstreams = [
{
destination_name = "s2"
local_bind_port = 5000
config {
protocol = "grpc"
}
}
]
config {
protocol = "grpc"
envoy_dogstatsd_url = "udp://127.0.0.1:8125"
envoy_stats_tags = ["foo=bar"]
envoy_stats_flush_interval = "5s"
}
}
}
}
}
2 changes: 1 addition & 1 deletion test/integration/connect/envoy/case-grpc/verify.bats
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ load helpers
metrics_query='envoy.cluster.grpc.PingServer.total.*[#,]local_cluster:s1(,|$)'
fi

run retry_default must_match_in_statsd_logs "${metrics_query}"
run retry_long must_match_in_statsd_logs "${metrics_query}"
echo "OUTPUT: $output"

[ "$status" == 0 ]
Expand Down
25 changes: 3 additions & 22 deletions test/integration/connect/envoy/helpers.windows.bash
Original file line number Diff line number Diff line change
Expand Up @@ -642,32 +642,13 @@ function kill_envoy {
tskill $PID
}

# This function is needed since socats SYSTEM isn't working.
function split_lines_in_stats {
local MATCH=$1
local FILE=$2
local LINE_COUNT=$( sed -n '$=' $FILE )
if [[ $LINE_COUNT == "1" ]]
then
sed -i "s/$MATCH/\n$MATCH/g" $FILE
else
return 0
fi
}

function must_match_in_statsd_logs {
local DC=${2:-primary}
local FILE="/c/workdir/${DC}/statsd/statsd.log"

split_lines_in_stats envoy $FILE

run cat $FILE
echo "$output"
COUNT=$( echo "$output" | grep -Ec $1 )


COUNT=$( grep -Ec $1 $FILE )
echo "COUNT of '$1' matches: $COUNT"

[ "$status" == 0 ]

[ "$COUNT" -gt "0" ]
}

Expand Down

0 comments on commit 80bfa8d

Please sign in to comment.