Skip to content

Commit 41abd7a

Browse files
authored
Fix WindowsFS test failure seen on Policeman Jenkins (#14706)
1 parent ca42707 commit 41abd7a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lucene/CHANGES.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ Other
142142

143143
* GITHUB#14516: Move sloppySin into SloppyMath from GeoUtils (Ankit Jain)
144144

145-
* GITHUB#14627, GITHUB#11920: Fix mock filesystem WindowsFS to also work on Windows.
146-
This is required to make tests pass on Windows 11 which no longer has
147-
all limitations of previous Windows versions. (Uwe Schindler)
145+
* GITHUB#14627, GITHUB#11920, GITHUB#14706: Fix mock filesystem WindowsFS to also
146+
work on Windows. This is required to make tests pass on Windows 11 which no
147+
longer has all limitations of previous Windows versions. (Uwe Schindler)
148148

149149

150150
======================= Lucene 10.2.1 =======================

lucene/test-framework/src/test/org/apache/lucene/tests/mockfile/TestWindowsFS.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,16 @@ public void testFileName() {
197197
if (r.nextBoolean()) {
198198
// We need at least one char after the special char
199199
// For example, in case of '/' we interpret `foo/` to just be a file `foo` which is valid
200+
// We need at least 2 chars before the special character, because resolving a drive
201+
// letter (C:) or a path starting with "/" will not fail on real Windows.
200202
fileName =
201-
RandomStrings.randomAsciiLettersOfLength(r, r.nextInt(10))
203+
RandomStrings.randomAsciiLettersOfLength(r, r.nextInt(2, 10))
202204
+ reservedCharacters[r.nextInt(reservedCharacters.length)]
203205
+ RandomStrings.randomAsciiLettersOfLength(r, r.nextInt(1, 10));
204206
} else {
205207
fileName = reservedNames[r.nextInt(reservedNames.length)];
206208
}
207-
expectThrows(InvalidPathException.class, () -> dir.resolve(fileName));
209+
expectThrows(InvalidPathException.class, fileName, () -> dir.resolve(fileName));
208210

209211
// some other basic tests
210212
expectThrows(InvalidPathException.class, () -> dir.resolve("foo:bar"));

0 commit comments

Comments
 (0)