Skip to content

Commit 1fa220d

Browse files
committed
DirectIOIT now checks that direct IO not supported is also logged
1 parent 72249f3 commit 1fa220d

File tree

1 file changed

+14
-5
lines changed
  • server/src/internalClusterTest/java/org/elasticsearch/index/store

1 file changed

+14
-5
lines changed

server/src/internalClusterTest/java/org/elasticsearch/index/store/DirectIOIT.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,16 @@
4242
@LuceneTestCase.SuppressCodecs("*") // only use our own codecs
4343
public class DirectIOIT extends ESIntegTestCase {
4444

45+
private static boolean SUPPORTED;
46+
4547
@BeforeClass
4648
public static void checkSupported() throws IOException {
4749
Path path = createTempDir("directIOProbe");
4850
try (Directory dir = open(path); IndexOutput out = dir.createOutput("out", IOContext.DEFAULT)) {
4951
out.writeString("test");
52+
SUPPORTED = true;
5053
} catch (IOException e) {
51-
assumeNoException("test requires filesystem that supports Direct IO", e);
54+
SUPPORTED = false;
5255
}
5356
}
5457

@@ -106,15 +109,21 @@ static void assertBBQIndexType(String type) {
106109
@TestLogging(value = "org.elasticsearch.index.store.FsDirectoryFactory:DEBUG", reason = "to capture trace logging for direct IO")
107110
public void testDirectIOUsed() {
108111
try (MockLog mockLog = MockLog.capture(FsDirectoryFactory.class)) {
109-
// we're just looking for some evidence direct IO is used
110-
mockLog.addExpectation(
111-
new MockLog.PatternSeenEventExpectation(
112+
// we're just looking for some evidence direct IO is used (or not)
113+
MockLog.LoggingExpectation expectation = SUPPORTED
114+
? new MockLog.PatternSeenEventExpectation(
112115
"Direct IO used",
113116
FsDirectoryFactory.class.getCanonicalName(),
114117
Level.DEBUG,
115118
"Opening .*\\.vec with direct IO"
116119
)
117-
);
120+
: new MockLog.PatternSeenEventExpectation(
121+
"Direct IO not used",
122+
FsDirectoryFactory.class.getCanonicalName(),
123+
Level.DEBUG,
124+
"Could not open .*\\.vec with direct IO"
125+
);
126+
mockLog.addExpectation(expectation);
118127

119128
indexVectors();
120129

0 commit comments

Comments
 (0)