Skip to content

Commit bf2882e

Browse files
committed
test: add streaming DSL and fix receive race
Introduces a robust testing DSL for gRPC streaming scenarios and fixes a concurrency bug in the legacy test utilities. Key Improvements: - **DSL:** Adds high-level request builders (`ReqLLM`, `ReqRaw`) to create readable, intent-based test cases. - **Race Fix:** Refactors `StreamedRequest` to use a serial read loop. Previously, concurrent `Recv()` calls caused undefined behavior that masked server responses. - **Robustness:** Updates `GetFreePort` to prevent race conditions during parallel test execution. **Note on EPP Tests:** The race condition fix in `StreamedRequest` stabilized the test output, revealing an incorrect assertion in `test/integration/epp/hermetic_test.go`. The server correctly returns a generic 400 error without echoing the invalid body (security best practice), but the test expected the body to be echo'd. The assertion has been updated to match the correct, stable server behavior.
1 parent 56e6721 commit bf2882e

File tree

2 files changed

+278
-112
lines changed

2 files changed

+278
-112
lines changed

test/integration/epp/hermetic_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func TestFullDuplexStreamed_KubeInferenceObjectiveRequest(t *testing.T) {
228228
wantErr: false,
229229
wantResponses: integrationutils.NewImmediateErrorResponse(
230230
envoyTypePb.StatusCode_BadRequest,
231-
"inference gateway: BadRequest - Error unmarshaling request body: no healthy upstream",
231+
"inference gateway: BadRequest - Error unmarshaling request body",
232232
),
233233
},
234234
{
@@ -804,7 +804,7 @@ func TestFullDuplexStreamed_KubeInferenceObjectiveRequest(t *testing.T) {
804804
},
805805
},
806806
},
807-
wantResponses: []*extProcPb.ProcessingResponse{},
807+
wantResponses: nil,
808808
pods: newPodStates(
809809
podState{index: 0, queueSize: 4, kvCacheUsage: 0.2, activeModels: []string{"foo", "bar", modelSheddableTarget}},
810810
),

0 commit comments

Comments
 (0)