Skip to content

Commit

Permalink
Fix ReadContextListenerTests to avoid inconsistent WindowsFS file han…
Browse files Browse the repository at this point in the history
…dle simulation (#9915) (#9949)

(cherry picked from commit 5c3d26d)

Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 27cddec commit c3e78c2
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.common.blobstore.stream.read.listener;

import org.apache.lucene.tests.util.LuceneTestCase.SuppressFileSystems;
import org.opensearch.action.LatchedActionListener;
import org.opensearch.action.support.PlainActionFuture;
import org.opensearch.common.blobstore.stream.read.ReadContext;
Expand All @@ -32,6 +33,12 @@

import static org.opensearch.common.blobstore.stream.read.listener.ListenerTestUtils.CountingCompletionListener;

/*
WindowsFS tries to simulate file handles in a best case simulation.
The deletion for the open file on an actual Windows system will be performed as soon as the last handle
is closed, which this simulation does not account for. Preventing use of WindowsFS for these tests.
*/
@SuppressFileSystems("WindowsFS")
public class ReadContextListenerTests extends OpenSearchTestCase {

private Path path;
Expand Down Expand Up @@ -70,7 +77,6 @@ public void testReadContextListener() throws InterruptedException, IOException {
assertEquals(NUMBER_OF_PARTS * PART_SIZE, Files.size(fileLocation));
}

@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/9776")
public void testReadContextListenerFailure() throws Exception {
Path fileLocation = path.resolve(UUID.randomUUID().toString());
List<InputStreamContainer> blobPartStreams = initializeBlobPartStreams();
Expand Down Expand Up @@ -100,7 +106,7 @@ public int available() {
readContextListener.onResponse(readContext);

countDownLatch.await();
assertBusy(() -> { assertFalse(Files.exists(fileLocation)); });
assertFalse(Files.exists(fileLocation));
}

public void testReadContextListenerException() {
Expand Down

0 comments on commit c3e78c2

Please sign in to comment.