Skip to content

Commit 0966b5c

Browse files
authored
test: stabilize rolling restart graceful shutdown e2e (llm-d#545)
Make the rolling restart shutdown test deterministic by slowing the simulator so requests stay in flight until SIGTERM arrives. This removes the timing race that let the batch complete before orphan recovery could be exercised. Signed-off-by: Jooyeon Mok <jmok@redhat.com>
1 parent 562218d commit 0966b5c

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

test/e2e/e2e_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ var (
5454

5555
// testSimService* hold the Kubernetes service names for the simulators.
5656
// Must match VLLM_SIM_*_NAME in dev-common.sh (overridable via env).
57+
testSimService = getEnvOrDefault("TEST_SIM_SERVICE", "vllm-sim")
5758
testSimService429 = getEnvOrDefault("TEST_SIM_SERVICE_429", "vllm-sim-429")
5859
testSimServiceAIMD = getEnvOrDefault("TEST_SIM_SERVICE_AIMD", "vllm-sim-aimd")
5960

test/e2e/processor_graceful_shutdown_test.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,31 @@ func doTestPodDeleteMidJob(t *testing.T) {
9696
finalBatch.RequestCounts.Total)
9797
}
9898

99-
// doTestRollingRestartReEnqueue submits a batch with the same slow-request
100-
// pattern as doTestPodDeleteMidJob, triggers a rolling restart of the processor
101-
// deployment, and verifies the GC reconciler transitions the orphaned job to
102-
// failed. Same SIGTERM -> orphan -> reconciler path, different trigger.
99+
// doTestRollingRestartReEnqueue submits a batch, triggers a rolling restart of
100+
// the processor deployment, and verifies the GC reconciler transitions the
101+
// orphaned job to failed. Same SIGTERM -> orphan -> reconciler path as
102+
// PodDeleteMidJob, different trigger.
103+
//
104+
// Rolling restart delivers SIGTERM only after the new pod is Ready (~12s).
105+
// To guarantee requests are still in-flight when SIGTERM arrives, we set the
106+
// simulator's inter-token latency to 30s via /admin/config. This makes even a
107+
// single generated token take longer than the new-pod startup delay, eliminating
108+
// the race between request completion and SIGTERM delivery.
103109
func doTestRollingRestartReEnqueue(t *testing.T) {
104110
t.Helper()
105111

106112
if !testKubectlAvailable {
107113
t.Skip("kubectl not available, skipping rolling restart test")
108114
}
109115

116+
// Slow down the simulator so requests cannot complete before SIGTERM arrives.
117+
setSimAdminConfig(t, testSimService, `{"inter-token-latency":"30s"}`)
118+
t.Cleanup(func() {
119+
if err := trySetSimAdminConfig(t, testSimService, `{"inter-token-latency":"100ms"}`); err != nil {
120+
t.Errorf("cleanup: failed to restore %s inter-token-latency: %v", testSimService, err)
121+
}
122+
})
123+
110124
var lines []string
111125
for i := 1; i <= 10; i++ {
112126
lines = append(lines, fmt.Sprintf(

0 commit comments

Comments
 (0)