github.com/instana/go-sensor@v1.62.2-0.20240520081010-4919868049e1/autoprofile/internal/allocation_sampler_test.go (about) 1 // (c) Copyright IBM Corp. 2021 2 // (c) Copyright Instana Inc. 2020 3 4 package internal_test 5 6 import ( 7 "fmt" 8 "runtime" 9 "testing" 10 11 "github.com/instana/go-sensor/autoprofile/internal" 12 "github.com/stretchr/testify/assert" 13 "github.com/stretchr/testify/require" 14 ) 15 16 var objs []string 17 18 func TestCreateAllocationCallGraph(t *testing.T) { 19 objs = make([]string, 1000000) 20 defer func() { objs = nil }() 21 22 runtime.GC() 23 runtime.GC() 24 25 samp := internal.NewAllocationSampler() 26 internal.IncludeProfilerFrames = true 27 28 profile, err := samp.Profile(500*1e6, 120) 29 require.NoError(t, err) 30 31 assert.Contains(t, fmt.Sprintf("%v", internal.NewAgentProfile(profile)), "TestCreateAllocationCallGraph") 32 }