handlePseudoQuery handles special pseudo-queries that are used to orchestrate replication tests and returns whether one was handled.
(t *testing.T, query string, r *logrepl.LogicalReplicator)
| 699 | // handlePseudoQuery handles special pseudo-queries that are used to orchestrate replication tests and returns whether |
| 700 | // one was handled. |
| 701 | func handlePseudoQuery(t *testing.T, query string, r *logrepl.LogicalReplicator) bool { |
| 702 | switch query { |
| 703 | case createReplicationSlot: |
| 704 | require.NoError(t, r.CreateReplicationSlotIfNecessary(slotName)) |
| 705 | return true |
| 706 | case dropReplicationSlot: |
| 707 | require.NoError(t, r.DropReplicationSlot(slotName)) |
| 708 | return true |
| 709 | case startReplication: |
| 710 | go func() { |
| 711 | require.NoError(t, r.StartReplication(slotName)) |
| 712 | }() |
| 713 | require.NoError(t, waitForRunning(r)) |
| 714 | return true |
| 715 | case stopReplication: |
| 716 | r.Stop() |
| 717 | return true |
| 718 | case waitForCatchup: |
| 719 | require.NoError(t, waitForCaughtUp(r)) |
| 720 | return true |
| 721 | case sleep: |
| 722 | time.Sleep(200 * time.Millisecond) |
| 723 | return true |
| 724 | } |
| 725 | return false |
| 726 | } |
| 727 | |
| 728 | // clientSpecFromQueryComment returns "replica" if the query is meant to be run on the replica, and "primary" if it's meant |
| 729 | // to be run on the primary, based on the comment in the query. If not comment, the query runs on the primary |
no test coverage detected