Browse Source

integ test: fix retry upstream test (#16246)

pull/16247/head
cskh 2 years ago committed by GitHub
parent
commit
5b7f36c2ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      test/integration/connect/envoy/case-dogstatsd-udp/verify.bats
  2. 4
      test/integration/connect/envoy/case-statsd-udp/verify.bats
  3. 4
      test/integration/connect/envoy/case-zipkin/verify.bats
  4. 19
      test/integration/connect/envoy/helpers.bash

7
test/integration/connect/envoy/case-dogstatsd-udp/verify.bats

@ -20,12 +20,7 @@ load helpers
}
@test "s1 upstream should be able to connect to s2" {
run retry_default curl -s -f -d hello localhost:5000
echo "OUTPUT: $output"
[ "$status" == 0 ]
[ "$output" == "hello" ]
retry_default assert_upstream_message 5000
}
@test "s1 proxy should be sending metrics to statsd" {

4
test/integration/connect/envoy/case-statsd-udp/verify.bats

@ -20,9 +20,7 @@ load helpers
}
@test "s1 upstream should be able to connect to s2" {
run retry_default curl -s -f -d hello localhost:5000
[ "$status" == 0 ]
[ "$output" == "hello" ]
retry_default assert_upstream_message 5000
}
@test "s1 proxy should be sending metrics to statsd" {

4
test/integration/connect/envoy/case-zipkin/verify.bats

@ -28,9 +28,7 @@ load helpers
}
@test "s1 upstream should be able to connect to s2" {
run retry_default curl -s -f -d hello localhost:5000
[ "$status" == "0" ]
[ "$output" == "hello" ]
retry_default assert_upstream_message 5000
}
@test "s1 proxy should send trace spans to zipkin/jaeger" {

19
test/integration/connect/envoy/helpers.bash

@ -46,6 +46,25 @@ function retry_long {
retry 30 1 "$@"
}
# assert_upstream_message asserts both the returned code
# and message from upstream service
function assert_upstream_message {
local HOSTPORT=$1
run curl -s -d hello localhost:$HOSTPORT
if [ "$status" -ne 0 ]; then
echo "Command failed"
return 1
fi
if (echo $output | grep 'hello'); then
return 0
fi
echo "expected message not found in $output"
return 1
}
function is_set {
# Arguments:
# $1 - string value to check its truthiness

Loading…
Cancel
Save