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

Function RunReplicationScript

testing/go/replication_test.go:546–569  ·  view source on GitHub ↗

RunReplicationScript runs the given ReplicationTest.

(t *testing.T, script ReplicationTest)

Source from the content-addressed store, hash-verified

544
545// RunReplicationScript runs the given ReplicationTest.
546func RunReplicationScript(t *testing.T, script ReplicationTest) {
547 scriptDatabase := script.Database
548 if len(scriptDatabase) == 0 {
549 scriptDatabase = "postgres"
550 }
551
552 database := "postgres"
553 // primaryDns is the connection to the actual postgres (not doltgres) database, which is why we use port 5342.
554 // If you have postgres running on a different port, you'll need to change this.
555 primaryDns := fmt.Sprintf("postgres://postgres:password@127.0.0.1:%d/%s?sslmode=disable", localPostgresPort, database)
556
557 ctx, replicaConn, controller := CreateServer(t, scriptDatabase)
558 defer func() {
559 replicaConn.Close(ctx)
560 controller.Stop()
561 err := controller.WaitForStop()
562 require.NoError(t, err)
563 }()
564
565 ctx = context.Background()
566 t.Run(script.Name, func(t *testing.T) {
567 runReplicationScript(ctx, t, script, replicaConn.Default, primaryDns)
568 })
569}
570
571func newReplicator(t *testing.T, walFilePath string, replicaConn *pgx.Conn, primaryDns string) *logrepl.LogicalReplicator {
572 connString := replicaConn.PgConn().Conn().RemoteAddr().String()

Callers 1

RunReplicationScriptsFunction · 0.85

Calls 5

runReplicationScriptFunction · 0.85
RunMethod · 0.80
CreateServerFunction · 0.70
CloseMethod · 0.65
StopMethod · 0.45

Tested by

no test coverage detected