Skip to content

Commit

Permalink
Fix data race.
Browse files Browse the repository at this point in the history
  • Loading branch information
winder committed Jun 22, 2023
1 parent 49e7f9e commit f3921c2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions daemon/algod/api/server/v2/test/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"fmt"
"io"
"math"
"net"
"net/http"
"net/http/httptest"
"strings"
Expand Down Expand Up @@ -2211,13 +2212,11 @@ func TestRouterRequestBody(t *testing.T) {
mockLedger, _, _, _, _ := testingenv(t, 1, 1, true)
mockNode := makeMockNode(mockLedger, t.Name(), nil, cannedStatusReportGolden, false)
dummyShutdownChan := make(chan struct{})
e := server.NewRouter(logging.TestingLog(t), mockNode, dummyShutdownChan, "", "", nil, 1000)
l, err := net.Listen("tcp", ":0") // create listener so requests are buffered
e := server.NewRouter(logging.TestingLog(t), mockNode, dummyShutdownChan, "", "", l, 1000)
go e.Start(":0")
defer e.Close()

// wait for server to start
require.Eventually(t, func() bool { return e.Listener != nil }, 5*time.Second, 100*time.Millisecond)

// Admin API call greater than max body bytes should succeed
assert.Equal(t, "10MB", server.MaxRequestBodyBytes)
stringReader := strings.NewReader(strings.Repeat("a", 50_000_000))
Expand Down

0 comments on commit f3921c2

Please sign in to comment.