MCPcopy Create free account
hub / github.com/dolthub/doltgresql / CreateServerWithPort

Function CreateServerWithPort

testing/go/framework.go:412–430  ·  view source on GitHub ↗

CreateServerWithPort creates a server with the given database and port, returning a connection to the server. The server will close when the connection is closed (or loses its connection to the server). The accompanying [svcs.Controller] may be used to wait until the server has closed.

(t *testing.T, database string, port int)

Source from the content-addressed store, hash-verified

410// when the connection is closed (or loses its connection to the server). The accompanying [svcs.Controller] may be used
411// to wait until the server has closed.
412func CreateServerWithPort(t *testing.T, database string, port int) (context.Context, *Connection, *svcs.Controller) {
413 require.NotEmpty(t, database)
414 controller, err := dserver.RunInMemory(&servercfg.DoltgresConfig{
415 DoltgresConfig: cfgdetails.DoltgresConfig{
416 ListenerConfig: &cfgdetails.DoltgresListenerConfig{
417 PortNumber: &port,
418 HostStr: &serverHost,
419 },
420 LogLevelStr: &testServerLogLevel,
421 },
422 }, dserver.NewListener)
423 require.NoError(t, err)
424 auth.ClearDatabase()
425 fmt.Printf("port is %d\n", port)
426
427 ctx := context.Background()
428 connection := newTestDatabaseConnection(t, ctx, database, serverHost, port)
429 return ctx, connection, controller
430}
431
432// CreateServerLocalWithPort creates a server using the local file system at [os.TempDir]. A Connection is returned to
433// |database| at 127.0.0.1:|port|. The server will close when the connection is closed or lost. The returned

Callers 4

RunWireScriptsFunction · 0.85
CreateServerFunction · 0.85
RunImportTestFunction · 0.85

Calls 3

ClearDatabaseFunction · 0.92
PrintfMethod · 0.80

Tested by 3

RunWireScriptsFunction · 0.68
RunImportTestFunction · 0.68