Skip to content

Commit a2d841b

Browse files
authored
Fix e2e test flake when setting fake metrics (#346)
adds retry logic to setting llm-d simulator fake metrics. - e2e_benchmark_test.go tests patch the simulator deployment via patchSimArgs(...) which runs kubectl patch deployment llm-sim. This causes Kubernetes to terminate the old llm-sim pod and spawn a new one. connections across requests. - Previously, setSimWaitingRequests in test/e2e/utils_test.go made only a single HTTP attempt. Any transient connection reset or socket transition during container rollouts caused the entire suite to fail immediately. Signed-off-by: Jacob Murry <jacobmurry@google.com>
1 parent 4a036eb commit a2d841b

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

test/e2e/utils_test.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,22 @@ func setSimWaitingRequests(simAdminURL string, waitingRequests int) {
122122
body, _ := json.Marshal(map[string]any{
123123
"waiting-requests": waitingRequests,
124124
})
125-
req, err := http.NewRequest(http.MethodPost, simAdminURL+"/fake_metrics", bytes.NewReader(body))
126-
gomega.ExpectWithOffset(1, err).NotTo(gomega.HaveOccurred())
127-
req.Header.Set("Content-Type", "application/json")
128-
resp, err := httpClient.Do(req)
129-
gomega.ExpectWithOffset(1, err).NotTo(gomega.HaveOccurred())
130-
defer resp.Body.Close() //nolint:errcheck
131-
gomega.ExpectWithOffset(1, resp.StatusCode).To(gomega.BeElementOf(http.StatusOK, http.StatusNoContent))
125+
gomega.EventuallyWithOffset(1, func() error {
126+
req, err := http.NewRequest(http.MethodPost, simAdminURL+"/fake_metrics", bytes.NewReader(body))
127+
if err != nil {
128+
return err
129+
}
130+
req.Header.Set("Content-Type", "application/json")
131+
resp, err := httpClient.Do(req)
132+
if err != nil {
133+
return err
134+
}
135+
defer resp.Body.Close() //nolint:errcheck
136+
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent {
137+
return fmt.Errorf("unexpected status code: %d", resp.StatusCode)
138+
}
139+
return nil
140+
}, 10*time.Second, 500*time.Millisecond).Should(gomega.Succeed())
132141
}
133142

134143
// sendProbeRequest sends a minimal inference request through Envoy → EPP to trigger

0 commit comments

Comments
 (0)