comparison tests/OnClientTester.java @ 548:d1f6678f92c5 onclient

Test that throwing an IO Exception in the download handler invalidates the connection At the moment we cannot report the error to the server. It is easier to invalidate the connection now and switch to something more sophisticated in the future than the other way around.
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Tue, 14 Sep 2021 09:23:21 +0200 (2021-09-14)
parents 79393647d7fb
children 5ce6a942aff3
comparison
equal deleted inserted replaced
547:8029d7368b5a 548:d1f6678f92c5
235 assertEq("connection is closed", true, conn.isClosed()); 235 assertEq("connection is closed", true, conn.isClosed());
236 // Cannot check the server log, but at the time I checked, it said "prematurely stopped client", which is fine. 236 // Cannot check the server log, but at the time I checked, it said "prematurely stopped client", which is fine.
237 } 237 }
238 238
239 // Disabled because it hangs, triggering the watchdog timer 239 // Disabled because it hangs, triggering the watchdog timer
240 public void testx_FailDownloadLate() throws SQLException, Failure { 240 public void test_FailDownloadLate() throws SQLException, Failure {
241 prepare(); 241 prepare();
242 MyDownloadHandler handler = new MyDownloadHandler(200, "download refused"); 242 MyDownloadHandler handler = new MyDownloadHandler(200, "download refused");
243 conn.setDownloadHandler(handler); 243 conn.setDownloadHandler(handler);
244 update("INSERT INTO foo SELECT value as i, 'number' || value AS t FROM sys.generate_series(0, 100)", 100); 244 update("INSERT INTO foo SELECT value as i, 'number' || value AS t FROM sys.generate_series(0, 100)", 100);
245 expectError("COPY (SELECT * FROM foo) INTO 'banana' ON CLIENT", "download refused"); 245 expectError("COPY (SELECT * FROM sys.generate_series(0,200)) INTO 'banana' ON CLIENT", "download refused");
246 queryInt("SELECT 42 -- check if the connection still works", 42); 246 // Exception closes the connection
247 assertEq("connection is closed", conn.isClosed(), true);
247 } 248 }
248 249
249 static class MyUploadHandler implements UploadHandler { 250 static class MyUploadHandler implements UploadHandler {
250 private final int rows; 251 private final int rows;
251 private final int errorAt; 252 private final int errorAt;