fix flaky integration test (#14843)

This commit is contained in:
cskh 2022-10-03 16:55:05 -04:00 committed by GitHub
parent d9fe3578ac
commit 622804ad5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 20 deletions

View File

@ -26,28 +26,11 @@ load helpers
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s1 HEALTHY 1 assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s1 HEALTHY 1
} }
@test "s1 proxy should have been configured with max_connections in services" {
CLUSTER_THRESHOLD=$(get_envoy_cluster_config 127.0.0.1:20000 s1.default.primary | jq '.circuit_breakers.thresholds[0]')
echo $CLUSTER_THRESHOLD
MAX_CONNS=$(echo $CLUSTER_THRESHOLD | jq --raw-output '.max_connections')
MAX_PENDING_REQS=$(echo $CLUSTER_THRESHOLD | jq --raw-output '.max_pending_requests')
MAX_REQS=$(echo $CLUSTER_THRESHOLD | jq --raw-output '.max_requests')
echo "MAX_CONNS = $MAX_CONNS"
echo "MAX_PENDING_REQS = $MAX_PENDING_REQS"
echo "MAX_REQS = $MAX_REQS"
[ "$MAX_CONNS" = "100" ]
[ "$MAX_PENDING_REQS" = "200" ]
[ "$MAX_REQS" = "300" ]
}
@test "ingress-gateway should have healthy endpoints for s2" { @test "ingress-gateway should have healthy endpoints for s2" {
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s2 HEALTHY 1 assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s2 HEALTHY 1
} }
@test "s2 proxy should have been configured with max_connections using defaults" { @test "s2 proxy should have been configured with connection threshold from defaults" {
CLUSTER_THRESHOLD=$(get_envoy_cluster_config 127.0.0.1:20000 s2.default.primary | jq '.circuit_breakers.thresholds[0]') CLUSTER_THRESHOLD=$(get_envoy_cluster_config 127.0.0.1:20000 s2.default.primary | jq '.circuit_breakers.thresholds[0]')
echo $CLUSTER_THRESHOLD echo $CLUSTER_THRESHOLD

View File

@ -2,7 +2,11 @@ config_entries {
bootstrap { bootstrap {
kind = "ingress-gateway" kind = "ingress-gateway"
name = "ingress-gateway" name = "ingress-gateway"
Defaults {
MaxConnections = 10
MaxPendingRequests = 20
MaxConcurrentRequests = 30
}
listeners = [ listeners = [
{ {
port = 9999 port = 9999
@ -10,6 +14,8 @@ config_entries {
services = [ services = [
{ {
name = "s1" name = "s1"
MaxConnections = 100
MaxPendingRequests = 200
} }
] ]
} }

View File

@ -19,7 +19,24 @@ load helpers
} }
@test "ingress-gateway should have healthy endpoints for s1" { @test "ingress-gateway should have healthy endpoints for s1" {
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s1 HEALTHY 1 assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s1 HEALTHY 1
}
@test "s1 proxy should have been configured with connection threshold from defaults and service" {
CLUSTER_THRESHOLD=$(get_envoy_cluster_config 127.0.0.1:20000 s1.default.primary | jq '.circuit_breakers.thresholds[0]')
echo $CLUSTER_THRESHOLD
MAX_CONNS=$(echo $CLUSTER_THRESHOLD | jq --raw-output '.max_connections')
MAX_PENDING_REQS=$(echo $CLUSTER_THRESHOLD | jq --raw-output '.max_pending_requests')
MAX_REQS=$(echo $CLUSTER_THRESHOLD | jq --raw-output '.max_requests')
echo "MAX_CONNS = $MAX_CONNS"
echo "MAX_PENDING_REQS = $MAX_PENDING_REQS"
echo "MAX_REQS = $MAX_REQS"
[ "$MAX_CONNS" = "100" ]
[ "$MAX_PENDING_REQS" = "200" ]
[ "$MAX_REQS" = "30" ]
} }
@test "ingress should be able to connect to s1 via configured port" { @test "ingress should be able to connect to s1 via configured port" {