File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package main
22
33import (
4- "runtime"
54 "testing"
65
76 "github.com/containerd/log"
87 "github.com/docker/docker/daemon/config"
98 "github.com/google/go-cmp/cmp/cmpopts"
109 "github.com/spf13/pflag"
11- "go.opentelemetry.io/otel"
1210 "gotest.tools/v3/assert"
1311 is "gotest.tools/v3/assert/cmp"
1412 "gotest.tools/v3/fs"
@@ -281,29 +279,3 @@ func TestCDISpecDirs(t *testing.T) {
281279 })
282280 }
283281}
284-
285- // TestOtelMeterLeak tests for a memory leak in the OTEL meter implementation.
286- // Once the fixed OTEL is vendored, this test will fail - the workaround
287- // and this test should be removed then.
288- func TestOtelMeterLeak (t * testing.T ) {
289- meter := otel .Meter ("foo" )
290-
291- var before runtime.MemStats
292- runtime .ReadMemStats (& before )
293-
294- const counters = 10 * 1000 * 1000
295- for i := 0 ; i < counters ; i ++ {
296- _ , _ = meter .Int64Counter ("bar" )
297- }
298-
299- var after runtime.MemStats
300- runtime .ReadMemStats (& after )
301-
302- allocs := after .Mallocs - before .Mallocs
303- t .Log ("Allocations:" , allocs )
304-
305- if allocs < 10 {
306- // TODO: Remove Workaround OTEL memory leak in cmd/dockerd/daemon.go
307- t .Fatal ("Allocations count decreased. OTEL leak workaround is no longer needed!" )
308- }
309- }
You can’t perform that action at this time.
0 commit comments