diff --git a/internal/store/query_replica_projection_local_test.go b/internal/store/query_replica_projection_local_test.go index 37e21981..5baccdab 100644 --- a/internal/store/query_replica_projection_local_test.go +++ b/internal/store/query_replica_projection_local_test.go @@ -1,6 +1,7 @@ package store import ( + "bytes" "context" "errors" "fmt" @@ -172,11 +173,13 @@ type replicaFaultConn struct { armed *atomic.Bool } -func (c *replicaFaultConn) Read(b []byte) (int, error) { - if c.armed.CompareAndSwap(true, false) { +// Inject only on an application find wire message. A shared read switch can +// be consumed by the driver heartbeat connection before the application read. +func (c *replicaFaultConn) Write(b []byte) (int, error) { + if bytes.Contains(b, []byte("\x02find\x00")) && c.armed.CompareAndSwap(true, false) { return 0, context.DeadlineExceeded } - return c.Conn.Read(b) + return c.Conn.Write(b) } func TestQueryReplicaLargeResponseShrinksWithinFixedDeadlineLocal(t *testing.T) {