github.com/mier85/go-sensor@v1.30.1-0.20220920111756-9bf41b3bc7e0/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/testify/assert" 12 "github.com/instana/testify/require" 13 "github.com/mier85/go-sensor/autoprofile/internal" 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 }