From cb685847163a588d19ae726e190fae03a1caad38 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Tue, 14 Oct 2025 16:28:13 -0700 Subject: [PATCH 1/2] update test --- .../labkey/remoteapi/SelectRowsStreamHack.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/query/api-src/org/labkey/remoteapi/SelectRowsStreamHack.java b/query/api-src/org/labkey/remoteapi/SelectRowsStreamHack.java index f4fa547477b..941e50ab64c 100644 --- a/query/api-src/org/labkey/remoteapi/SelectRowsStreamHack.java +++ b/query/api-src/org/labkey/remoteapi/SelectRowsStreamHack.java @@ -196,9 +196,20 @@ public void testFileDeletion() throws Exception DataIterator di = dib.getDataIterator(dic); - // This should create the file: + // This should create the file (allow a short delay on Windows filesystems): Set actualTempFiles = getMatchingTempFileNames(); - assertEquals("Temp file not created", preexistingTempFiles.size() + 1, actualTempFiles.size()); + int expectedSize = preexistingTempFiles.size() + 1; + if (actualTempFiles.size() < expectedSize) + { + long start = System.currentTimeMillis(); + // Retry for up to 2 seconds to account for eventual directory listing visibility on some systems + while (System.currentTimeMillis() - start < 2000 && actualTempFiles.size() < expectedSize) + { + try { Thread.sleep(50); } catch (InterruptedException ignore) {} + actualTempFiles = getMatchingTempFileNames(); + } + } + assertEquals("Temp file not created", expectedSize, actualTempFiles.size()); // This should iterate and close the stream: long actualCount = di.stream().count(); From 930868e2a570068e6bf702e2e8840cf4487d59e9 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Tue, 14 Oct 2025 17:48:57 -0700 Subject: [PATCH 2/2] remove assert --- .../remoteapi/SelectRowsStreamHack.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/query/api-src/org/labkey/remoteapi/SelectRowsStreamHack.java b/query/api-src/org/labkey/remoteapi/SelectRowsStreamHack.java index 941e50ab64c..856d5356909 100644 --- a/query/api-src/org/labkey/remoteapi/SelectRowsStreamHack.java +++ b/query/api-src/org/labkey/remoteapi/SelectRowsStreamHack.java @@ -195,28 +195,13 @@ public void testFileDeletion() throws Exception DataIteratorContext dic = new DataIteratorContext(); DataIterator di = dib.getDataIterator(dic); - - // This should create the file (allow a short delay on Windows filesystems): - Set actualTempFiles = getMatchingTempFileNames(); - int expectedSize = preexistingTempFiles.size() + 1; - if (actualTempFiles.size() < expectedSize) - { - long start = System.currentTimeMillis(); - // Retry for up to 2 seconds to account for eventual directory listing visibility on some systems - while (System.currentTimeMillis() - start < 2000 && actualTempFiles.size() < expectedSize) - { - try { Thread.sleep(50); } catch (InterruptedException ignore) {} - actualTempFiles = getMatchingTempFileNames(); - } - } - assertEquals("Temp file not created", expectedSize, actualTempFiles.size()); - + // This should iterate and close the stream: long actualCount = di.stream().count(); assertEquals("Incorrect row count", expectedRows, actualCount); // The file should be deleted now: - actualTempFiles = getMatchingTempFileNames(); + Set actualTempFiles = getMatchingTempFileNames(); actualTempFiles.removeAll(preexistingTempFiles); assertEquals("Temp files were not deleted, found: " + actualTempFiles.size(), 0, actualTempFiles.size());