Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Commit

Permalink
Merge branch 'ufoot/waitreceivertest'
Browse files Browse the repository at this point in the history
  • Loading branch information
ufoot committed Feb 2, 2017
2 parents 748ade8 + 146addb commit c03b93c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions agent/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"net/http/httptest"
"testing"
"time"

"github.com/DataDog/datadog-trace-agent/config"
"github.com/DataDog/datadog-trace-agent/fixtures"
Expand All @@ -29,6 +30,22 @@ func TestReceiverRequestBodyLength(t *testing.T) {
url := fmt.Sprintf("http://%s:%d/v0.3/traces",
conf.ReceiverHost, conf.ReceiverPort)

// Before going further, make sure receiver is started
// since it's running in another goroutine
for i := 0; i < 10; i++ {
client := &http.Client{}

body := bytes.NewBufferString("[]")
req, err := http.NewRequest("POST", url, body)
assert.Nil(err)

resp, err := client.Do(req)
if err == nil && resp.StatusCode == http.StatusOK {
break
}
time.Sleep(10 * time.Millisecond)
}

testBody := func(expectedStatus int, bodyData string) {
client := &http.Client{}

Expand Down

0 comments on commit c03b93c

Please sign in to comment.