Skip to content

Commit

Permalink
documenting test for #10301
Browse files Browse the repository at this point in the history
  • Loading branch information
cgbaker committed Apr 5, 2021
1 parent af00546 commit dccd6e7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/url"
"os"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -538,3 +539,36 @@ func TestCloneHttpClient(t *testing.T) {
})

}

func TestClient_HeaderRaceCondition(t *testing.T) {
require := require.New(t)

conf := DefaultConfig()
conf.Headers = map[string][]string{
"test-header": {"a"},
}
client, err := NewClient(conf)
require.NoError(err)

wg := sync.WaitGroup{}
wg.Add(2)

go func() {
for i := 0; i < 500; i++ {
req, err := client.newRequest("GET", "/any/path/will/do")
require.NoError(err)
_, _ = req.toHTTP()
}
wg.Done()
}()
go func() {
for i := 0; i < 500; i++ {
req, err := client.newRequest("GET", "/any/path/will/do")
require.NoError(err)
_, _ = req.toHTTP()
}
wg.Done()
}()

wg.Wait()
}

0 comments on commit dccd6e7

Please sign in to comment.