mirror of
https://github.com/floci-io/floci.git
synced 2026-12-04 02:28:08 -05:00
test(redshift): leave the COPY backend silent until the read times out (#10089)
The Redshift COPY timeout test used a backend thread that read one query and slept for 300 ms. It now leaves its loopback peer connected and silent and, once the simulator's 100 ms read timeout expires, reads the forwarded COPY ... FROM STDIN query from the peer. Signed-off-by: Andre Kurait <akurait@amazon.com> Signed-off-by: Jackson Price <jxnprice@amazon.com> Co-authored-by: Andre Kurait <akurait@amazon.com>
This commit is contained in:
1 parent
05461679a7
commit
1afba75712
1 file changed
+6
-10
@@ -1825,21 +1825,17 @@ class S3CopySimulatorTest {
|
||||
|
||||
simBackend.setSoTimeout(100);
|
||||
|
||||
Thread backend = backendThread(() -> {
|
||||
new PostgresWireDecoder(testBackend.getInputStream()).nextMessage();
|
||||
try {
|
||||
Thread.sleep(300);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
});
|
||||
|
||||
// Keep the peer connected without sending a CopyInResponse.
|
||||
boolean handled = S3CopySimulator.runCopyFrom(simClient, simBackend, spec, s3, null, 'I');
|
||||
joinBackend(backend);
|
||||
assertTrue(handled);
|
||||
|
||||
assertTrue(simBackend.isClosed(), "simBackend must be closed upon timeout");
|
||||
|
||||
PostgresWireDecoder.FrontendMessage query = nextFromSimulatorToBackend();
|
||||
assertNotNull(query, "the backend must receive the COPY query before the timeout");
|
||||
assertEquals('Q', query.type());
|
||||
assertTrue(query.getSql().contains("FROM STDIN"));
|
||||
|
||||
PostgresWireDecoder in = new PostgresWireDecoder(testClient.getInputStream());
|
||||
assertEquals('E', in.nextMessage().type());
|
||||
assertEquals('Z', in.nextMessage().type());
|
||||
|
||||
Reference in new issue
Block a user