Skip to content

Commit 781869b

Browse files
authored
Merge pull request #90 from Dstack-TEE/vk/d9b5-dstack-ingress-2
2 parents 413c906 + 3a77de8 commit 781869b

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

custom-domain/dstack-ingress/scripts/tests/e2e-test.sh

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -272,25 +272,17 @@ else
272272
fail "HTTP/1.1 response doesn't look like whoami"
273273
fi
274274

275-
# ── HTTP/2 tests (against gRPC backend which supports h2c) ───────────────────
276-
# Note: with L4 proxy + ALPN h2, the backend MUST support h2c (cleartext HTTP/2).
277-
# whoami only speaks HTTP/1.1, so we test H2 against grpcbin which is a Go
278-
# gRPC server and natively supports h2c.
279-
280-
log "Test: HTTP/2 through TCP proxy (via gRPC domain)"
281-
H2_STATUS=$(do_curl -s -o /dev/null -w '%{http_code}' --http2 "https://${GRPC_DOMAIN}/" 2>/dev/null || echo "000")
282-
if [ "$H2_STATUS" != "000" ]; then
283-
pass "HTTP/2 connection successful (status: $H2_STATUS)"
275+
# ── HTTP/2 ALPN test ─────────────────────────────────────────────────────────
276+
# Verify TLS ALPN negotiation at the protocol level using openssl.
277+
# curl --http2 is unreliable here because grpcbin doesn't serve HTTP on GET /.
278+
279+
log "Test: TLS ALPN negotiates h2 (via gRPC domain)"
280+
ALPN_PROTO=$(echo | openssl s_client -connect "${DOMAIN_IP}:443" -servername "${GRPC_DOMAIN}" -alpn h2 2>/dev/null \
281+
| grep -oP 'ALPN protocol: \K\S+' || echo "")
282+
if [ "$ALPN_PROTO" = "h2" ]; then
283+
pass "TLS ALPN negotiated h2"
284284
else
285-
fail "HTTP/2 connection failed"
286-
fi
287-
288-
log "Test: HTTP/2 ALPN negotiation"
289-
H2_VER=$(do_curl -s -o /dev/null -w '%{http_version}' --http2 "https://${GRPC_DOMAIN}/" 2>/dev/null || echo "")
290-
if [ "$H2_VER" = "2" ]; then
291-
pass "HTTP/2 negotiated via ALPN (version: $H2_VER)"
292-
else
293-
fail "HTTP/2 not negotiated (version: $H2_VER)"
285+
fail "TLS ALPN expected h2, got: ${ALPN_PROTO:-none}"
294286
fi
295287

296288
# ── gRPC tests ───────────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)