mirror of https://github.com/apache/lucene.git
Fix TestHardLinkCopyDirectoryWrapper if an assume is hit all directories must be closed
This commit is contained in:
parent
268da5be45
commit
2aabed4ab6
|
@ -45,6 +45,7 @@ public class TestHardLinkCopyDirectoryWrapper extends BaseDirectoryTestCase {
|
|||
|
||||
Directory luceneDir_1 = newFSDirectory(dir_1);
|
||||
Directory luceneDir_2 = newFSDirectory(dir_2);
|
||||
try {
|
||||
try (IndexOutput output = luceneDir_1.createOutput("foo.bar", IOContext.DEFAULT)) {
|
||||
CodecUtil.writeHeader(output, "foo", 0);
|
||||
output.writeString("hey man, nice shot!");
|
||||
|
@ -57,7 +58,7 @@ public class TestHardLinkCopyDirectoryWrapper extends BaseDirectoryTestCase {
|
|||
assumeTrue("hardlinks are not supported", destAttr.fileKey() != null
|
||||
&& destAttr.fileKey().equals(sourceAttr.fileKey()));
|
||||
} catch (UnsupportedOperationException ex) {
|
||||
assumeFalse("hardlinks are not supported", false);
|
||||
assumeFalse("hardlinks are not supported", true);
|
||||
}
|
||||
|
||||
HardlinkCopyDirectoryWrapper wrapper = new HardlinkCopyDirectoryWrapper(luceneDir_2);
|
||||
|
@ -71,6 +72,10 @@ public class TestHardLinkCopyDirectoryWrapper extends BaseDirectoryTestCase {
|
|||
assertEquals("hey man, nice shot!", indexInput.readString());
|
||||
CodecUtil.checkFooter(indexInput);
|
||||
}
|
||||
} finally {
|
||||
// close them in a finally block we might run into an assume here
|
||||
IOUtils.close(luceneDir_1, luceneDir_2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue