package testsupport import ( "context" "github.com/stretchr/testify/suite" "net/http" "testing" "time" ) type InMemoryTestSuite struct { suite.Suite pprofServer *http.Server ctx context.Context cancelFunc context.CancelFunc pipe *InmemoryConnection } func TestInMemoryConnectionTestSuite(t *testing.T) { suite.Run(t, &InMemoryTestSuite{}) } func (s *InMemoryTestSuite) createConnection() { ctx, cancelFunc := CreateTestContext(context.Background(), 10*time.Second) s.ctx = ctx s.cancelFunc = cancelFunc s.pipe = NewInmemoryConnection(ctx, "inmemory") } func (s *InMemoryTestSuite) SetupSuite() { s.pprofServer = StartPprof("") } func (s *InMemoryTestSuite) TearDownSuite() { StopPprof(s.ctx, s.pprofServer) } func (s *InMemoryTestSuite) SetupTest() { s.createConnection() } func (s *InMemoryTestSuite) TearDownTest() { s.cancelFunc() }