Skip to content

Commit d3e6022

Browse files
committed
Fix concurrency handling in TestRuntimeAPILoopWithConcurrency
1 parent 137df52 commit d3e6022

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

lambda/invoke_loop_gte_go122_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ func TestRuntimeAPILoopWithConcurrency(t *testing.T) {
6565
endpoint := strings.Split(ts.URL, "://")[1]
6666
expectedError := fmt.Sprintf("failed to GET http://%s/2018-06-01/runtime/invocation/next: got unexpected status code: 410", endpoint)
6767
assert.EqualError(t, startRuntimeAPILoopWithConcurrency(endpoint, handler, concurrency), expectedError)
68+
record.lock.Lock()
6869
assert.GreaterOrEqual(t, record.nGets, nInvokes+1)
6970
assert.Equal(t, nInvokes, record.nPosts)
71+
record.lock.Unlock()
7072
assert.Equal(t, int32(concurrency), maxActive.Load())
7173
responses := make(map[string]int)
7274
for _, response := range record.responses {

lambda/invoke_loop_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,6 @@ 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-
459451
switch r.Method {
460452
case http.MethodGet:
461453
numInvokesRequestedLock.Lock()

0 commit comments

Comments
 (0)