github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/agent/dotnetspy/dotnetspy_test.go (about) 1 //go:build dotnetspy 2 // +build dotnetspy 3 4 package dotnetspy 5 6 import ( 7 "time" 8 9 . "github.com/onsi/ginkgo/v2" 10 . "github.com/onsi/gomega" 11 ) 12 13 var _ = Describe("agent.DotnetSpy", func() { 14 Describe("Does not panic if a session has not been established", func() { 15 s := newSession(31337) 16 s.timeout = time.Millisecond * 10 17 Expect(s.start()).To(HaveOccurred()) 18 spy := &DotnetSpy{session: s} 19 20 It("On Snapshot before Reset", func() { 21 spy.Snapshot(func(name []byte, samples uint64, err error) { 22 Fail("Snapshot callback must not be called") 23 }) 24 }) 25 26 It("On Snapshot after Reset", func() { 27 spy.Reset() 28 spy.Snapshot(func(name []byte, samples uint64, err error) { 29 Fail("Snapshot callback must not be called") 30 }) 31 }) 32 33 It("On Stop", func() { 34 Expect(spy.Stop()).ToNot(HaveOccurred()) 35 }) 36 }) 37 })