From 1afba75712d1d3bb66cbe7b4c55cccd650a8a5ad Mon Sep 17 00:00:00 2001 From: Jackson Price <59149601+jprice8@users.noreply.github.com> Date: Thu, 3 Dec 2026 13:07:19 -0600 Subject: [PATCH] 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 Signed-off-by: Jackson Price Co-authored-by: Andre Kurait --- .../redshift/proxy/S3CopySimulatorTest.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/test/java/io/floci/aws/services/redshift/proxy/S3CopySimulatorTest.java b/src/test/java/io/floci/aws/services/redshift/proxy/S3CopySimulatorTest.java index 7d30a8c60f..b485a64832 100644 --- a/src/test/java/io/floci/aws/services/redshift/proxy/S3CopySimulatorTest.java +++ b/src/test/java/io/floci/aws/services/redshift/proxy/S3CopySimulatorTest.java @@ -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());