github.com/icyphox/x@v0.0.355-0.20220311094250-029bd783e8b8/sqlcon/dockertest/cockroach.go (about)

     1  package dockertest
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/cockroachdb/cockroach-go/v2/testserver"
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  func NewLocalTestCRDBServer(t testing.TB) string {
    11  	ts, err := testserver.NewTestServer()
    12  	require.NoError(t, err)
    13  	t.Cleanup(ts.Stop)
    14  
    15  	require.NoError(t, ts.WaitForInit())
    16  
    17  	ts.PGURL().Scheme = "cockroach"
    18  	return ts.PGURL().String()
    19  }