diff --git a/pkg/trace/api/api_oom_test.go b/pkg/trace/api/api_oom_test.go index a4e36b6ba0f219..ccf8304c2fa92e 100644 --- a/pkg/trace/api/api_oom_test.go +++ b/pkg/trace/api/api_oom_test.go @@ -37,6 +37,7 @@ func TestOOMKill(t *testing.T) { conf.Endpoints[0].APIKey = "apikey_2" conf.WatchdogInterval = time.Millisecond conf.MaxMemory = 0.1 * 1000 * 1000 // 100KB + conf.ReceiverPort = 8327 // use non-default port to avoid conflict with running agent r := newTestReceiverFromConfig(conf) r.Start() @@ -58,7 +59,7 @@ func TestOOMKill(t *testing.T) { wg.Add(1) go func() { defer wg.Done() - resp, err := http.Post("http://localhost:8126/v0.4/traces", "application/msgpack", bytes.NewReader(data)) + resp, err := http.Post("http://localhost:8327/v0.4/traces", "application/msgpack", bytes.NewReader(data)) if err != nil { t.Log("Error posting payload", err) return diff --git a/pkg/trace/api/api_test.go b/pkg/trace/api/api_test.go index 19b468c6745d24..09faf6e7a023f3 100644 --- a/pkg/trace/api/api_test.go +++ b/pkg/trace/api/api_test.go @@ -64,6 +64,7 @@ func newTestReceiverConfig() *config.AgentConfig { conf := config.New() conf.Endpoints[0].APIKey = "test" conf.DecoderTimeout = 10000 + conf.ReceiverPort = 8326 // use non-default port to avoid conflict with a running agent return conf } @@ -166,6 +167,8 @@ func TestStateHeaders(t *testing.T) { assert := assert.New(t) cfg := newTestReceiverConfig() cfg.AgentVersion = "testVersion" + url := fmt.Sprintf("http://%s:%d", + cfg.ReceiverHost, cfg.ReceiverPort) r := newTestReceiverFromConfig(cfg) r.Start() defer r.Stop() @@ -183,7 +186,7 @@ func TestStateHeaders(t *testing.T) { "/v0.5/traces", "/v0.7/traces", } { - resp, err := http.Post("http://localhost:8126"+e, "application/msgpack", bytes.NewReader(data)) + resp, err := http.Post(url+e, "application/msgpack", bytes.NewReader(data)) if err != nil { t.Fatal(err) }