From de40fbb66945470d8e2cbca3c625ab153fad174a Mon Sep 17 00:00:00 2001 From: Abhishek Choudhary Date: Wed, 27 May 2026 19:23:03 +0800 Subject: [PATCH] test(e2e): fix debug-trace propagation wait so all 9 traffic tests run waitForDebugTraceRoute polled the gateway for a non-404 response code to decide the new route had propagated to the data plane. That worked only when the route's path happened to exist on the upstream too: in this repo's setup the upstream is go-httpbin, which serves /get, /post, /anything, etc., but not /debug-trace-test, /debug-trace-headers, etc. Result: routes did propagate within milliseconds, the gateway matched them, but it forwarded e.g. /debug-trace-test to httpbin which replied with its own 404. The wait loop interpreted that as "not propagated yet", spent the full 15s timeout, then soft-skipped. This was masked because some debug-trace tests already set their own proxy-rewrite plugin (rewriting to /post, /anything/*) for unrelated reasons; those tests passed in roughly half a second. The four tests that did NOT supply a plugin (JSONOutput, WithHeaders, WithHost, YAMLOutput) always skipped. Inject a default `proxy-rewrite: { uri: "/anything" }` in createDebugTraceRoute when the caller does not supply its own plugins. go-httpbin's /anything endpoint always returns 200 with a JSON echo, so the wait loop sees the route the moment it lands at the gateway. Callers that DO supply plugins (WithMethod, WithPath, WithHost) are unaffected. Local rerun: all 9 traffic tests pass; total wall time dropped from 67s to 8s. --- test/e2e/debug_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/e2e/debug_test.go b/test/e2e/debug_test.go index 04325bb..a93535d 100644 --- a/test/e2e/debug_test.go +++ b/test/e2e/debug_test.go @@ -8,6 +8,7 @@ import ( "net/http" "os" "path/filepath" + "strings" "testing" "time" @@ -17,6 +18,15 @@ import ( func createDebugTraceRoute(t testTB, env []string, serviceID, routeID, path string, extraFields string) { t.Helper() + // Inject a default proxy-rewrite to a path go-httpbin always serves so + // waitForDebugTraceRoute can use a non-404 response as the propagation + // signal. Without this every synthetic route path (e.g. /debug-trace-test) + // hits httpbin at the same path, which returns 404 forever, and the wait + // loop cannot distinguish "route not propagated" from "upstream has no + // such path". Callers that supply their own plugins keep them. + if !strings.Contains(extraFields, "plugins") { + extraFields += `, "plugins": {"proxy-rewrite": {"uri": "/anything"}}` + } routeJSON := fmt.Sprintf(`{ "id": %q, "name": %q,