Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ReadContextListenerTests to avoid inconsistent WindowsFS file han… #9915

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
kotwanikunal marked this conversation as resolved.
Show resolved Hide resolved
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