fix flaky integration test (#14843)

This commit is contained in:
cskh 2022-10-03 16:55:05 -04:00 committed by GitHub
parent 89141256c7
commit 1b587e7d13
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
}
@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" {
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]')
echo $CLUSTER_THRESHOLD

View File

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

View File

@ -22,6 +22,23 @@ load helpers
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" {
run retry_default curl -s -f -d hello localhost:9999
[ "$status" -eq 0 ]