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)
| 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. |
| 412 | func 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 |