Skip to content

Commit 137df52

Browse files
committed
Add context cancellation handling in runtimeAPIServer test
1 parent 8d3e975 commit 137df52

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lambda/invoke_loop_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,14 @@ func runtimeAPIServer(eventPayload string, failAfter int, overrides ...eventMeta
448448
record := &requestRecord{}
449449

450450
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
451+
select {
452+
case <-ctx.Done():
453+
w.WriteHeader(http.StatusGone)
454+
_, _ = w.Write([]byte("END THE TEST!"))
455+
return
456+
default:
457+
}
458+
451459
switch r.Method {
452460
case http.MethodGet:
453461
numInvokesRequestedLock.Lock()

0 commit comments

Comments
 (0)