|
42 | 42 | @LuceneTestCase.SuppressCodecs("*") // only use our own codecs |
43 | 43 | public class DirectIOIT extends ESIntegTestCase { |
44 | 44 |
|
| 45 | + private static boolean SUPPORTED; |
| 46 | + |
45 | 47 | @BeforeClass |
46 | 48 | public static void checkSupported() throws IOException { |
47 | 49 | Path path = createTempDir("directIOProbe"); |
48 | 50 | try (Directory dir = open(path); IndexOutput out = dir.createOutput("out", IOContext.DEFAULT)) { |
49 | 51 | out.writeString("test"); |
| 52 | + SUPPORTED = true; |
50 | 53 | } catch (IOException e) { |
51 | | - assumeNoException("test requires filesystem that supports Direct IO", e); |
| 54 | + SUPPORTED = false; |
52 | 55 | } |
53 | 56 | } |
54 | 57 |
|
@@ -106,15 +109,21 @@ static void assertBBQIndexType(String type) { |
106 | 109 | @TestLogging(value = "org.elasticsearch.index.store.FsDirectoryFactory:DEBUG", reason = "to capture trace logging for direct IO") |
107 | 110 | public void testDirectIOUsed() { |
108 | 111 | 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( |
112 | 115 | "Direct IO used", |
113 | 116 | FsDirectoryFactory.class.getCanonicalName(), |
114 | 117 | Level.DEBUG, |
115 | 118 | "Opening .*\\.vec with direct IO" |
116 | 119 | ) |
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); |
118 | 127 |
|
119 | 128 | indexVectors(); |
120 | 129 |
|
|
0 commit comments