Skip to content

Commit f849c83

Browse files
committed
fix test
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
1 parent 87b01dc commit f849c83

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

test/e2e/testdata/dynamic-resolver-original-host-accesslog.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
- format:
3232
type: JSON
3333
json:
34-
x-request-id: "%REQ(X-REQUEST-ID)%"
34+
test-id: "%REQ(X-EG-TEST-ID)%"
3535
http.host: "%REQ(HOST)%"
3636
http.original_host: "%REQ(X-ENVOY-ORIGINAL-HOST)%"
3737
matches:

test/e2e/tests/dynamic_resolver_original_host_accesslog.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var DynamicResolverOriginalHostAccessLogTest = suite.ConformanceTest{
5858
Path: "/original-host",
5959
Headers: map[string]string{
6060
"x-envoy-logged": "1",
61-
"x-request-id": requestID,
61+
"x-eg-test-id": requestID,
6262
},
6363
},
6464
ExpectedRequest: &http.ExpectedRequest{
@@ -76,7 +76,7 @@ var DynamicResolverOriginalHostAccessLogTest = suite.ConformanceTest{
7676
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse)
7777

7878
labels := getOTELLabels(ns)
79-
match := `\"x-request-id\":\"` + requestID + `\"`
79+
match := `\"test-id\":\"` + requestID + `\"`
8080

8181
var matchedLog string
8282
err := wait.PollUntilContextTimeout(context.Background(), time.Second, time.Minute, true, func(_ context.Context) (bool, error) {
@@ -94,15 +94,28 @@ var DynamicResolverOriginalHostAccessLogTest = suite.ConformanceTest{
9494
continue
9595
}
9696

97-
if gotRequestID, ok := entry["x-request-id"].(string); ok && gotRequestID == requestID {
97+
if gotRequestID, ok := entry["test-id"].(string); ok && gotRequestID == requestID {
9898
matchedLog = line
9999
return true, nil
100100
}
101101
}
102102

103103
return false, nil
104104
})
105-
time.Sleep(5*time.Hour)
105+
if err != nil {
106+
lines, linesErr := QueryLogLinesFromLoki(t, suite.Client, labels, "")
107+
if linesErr != nil {
108+
tlog.Logf(t, "failed to query unfiltered log lines from loki: %v", linesErr)
109+
} else {
110+
tlog.Logf(t, "diagnostic: found %d unfiltered OTEL log lines", len(lines))
111+
for i, line := range lines {
112+
if i >= 10 {
113+
break
114+
}
115+
tlog.Logf(t, "diagnostic unfiltered access log line %d: %s", i, line)
116+
}
117+
}
118+
}
106119
require.NoError(t, err, "timed out waiting for access log line for request id %s", requestID)
107120

108121
entry := map[string]string{}

0 commit comments

Comments
 (0)