diff --git a/profiler/profiler_test.go b/profiler/profiler_test.go index e9d56444c2..5e94eac82e 100644 --- a/profiler/profiler_test.go +++ b/profiler/profiler_test.go @@ -236,41 +236,6 @@ func TestSetProfileFraction(t *testing.T) { }) } -func TestProfilerPassthrough(t *testing.T) { - if testing.Short() { - return - } - beforeExecutionTraceEnabledDefault := executionTraceEnabledDefault - executionTraceEnabledDefault = false - defer func() { executionTraceEnabledDefault = beforeExecutionTraceEnabledDefault }() - - out := make(chan batch) - p, err := newProfiler() - require.NoError(t, err) - p.cfg.period = 200 * time.Millisecond - p.cfg.cpuDuration = 1 * time.Millisecond - p.uploadFunc = func(bat batch) error { - out <- bat - return nil - } - p.run() - defer p.stop() - var bat batch - select { - case bat = <-out: - // TODO (knusbaum) this timeout is long because we were seeing timeouts at 500ms. - // it would be nice to have a time-independent way to test this - case <-time.After(1000 * time.Millisecond): - t.Fatal("time expired") - } - - assert := assert.New(t) - // should contain cpu.pprof, delta-heap.pprof - assert.Equal(2, len(bat.profiles)) - assert.NotEmpty(bat.profiles[0].data) - assert.NotEmpty(bat.profiles[1].data) -} - func unstartedProfiler(opts ...Option) (*profiler, error) { p, err := newProfiler(opts...) if err != nil { diff --git a/profiler/upload_test.go b/profiler/upload_test.go index acaa471011..1e56eb0e4a 100644 --- a/profiler/upload_test.go +++ b/profiler/upload_test.go @@ -7,7 +7,6 @@ package profiler import ( "fmt" - "io" "net" "net/http" "net/http/httptest" @@ -187,36 +186,6 @@ func TestEntityIDHeader(t *testing.T) { assert.Equal(t, entityID, profile.headers.Get("Datadog-Entity-Id")) } -func BenchmarkDoRequest(b *testing.B) { - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - _, err := io.ReadAll(req.Body) - if err != nil { - b.Fatal(err) - } - req.Body.Close() - w.WriteHeader(200) - })) - defer srv.Close() - prof := profile{ - name: "heap", - data: []byte("my-heap-profile"), - } - bat := batch{ - start: time.Now().Add(-10 * time.Second), - end: time.Now(), - host: "my-host", - profiles: []*profile{&prof}, - } - p, err := unstartedProfiler() - require.NoError(b, err) - b.ReportAllocs() - b.ResetTimer() - - for i := 0; i < b.N; i++ { - p.doRequest(bat) - } -} - func TestGitMetadata(t *testing.T) { maininternal.ResetGitMetadataTags() defer maininternal.ResetGitMetadataTags()