You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2025/05/23 18:34:54 UTC

(lucene) branch branch_10x updated: Fix WindowsFS test failure seen on Policeman Jenkins (#14706)

This is an automated email from the ASF dual-hosted git repository.

uschindler pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_10x by this push:
     new 2fa9a91b222 Fix WindowsFS test failure seen on Policeman Jenkins (#14706)
2fa9a91b222 is described below

commit 2fa9a91b2225bae2be5f8b76e1be4c4eee440c17
Author: Uwe Schindler <us...@apache.org>
AuthorDate: Fri May 23 20:33:37 2025 +0200

    Fix WindowsFS test failure seen on Policeman Jenkins (#14706)
---
 lucene/CHANGES.txt                                                  | 6 +++---
 .../src/test/org/apache/lucene/tests/mockfile/TestWindowsFS.java    | 6 ++++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 70697fbedbb..61dd263791e 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -80,9 +80,9 @@ Other
 
 * GITHUB#14516: Move sloppySin into SloppyMath from GeoUtils (Ankit Jain)
 
-* GITHUB#14627, GITHUB#11920: Fix mock filesystem WindowsFS to also work on Windows.
-  This is required to make tests pass on Windows 11 which no longer has
-  all limitations of previous Windows versions.  (Uwe Schindler)
+* GITHUB#14627, GITHUB#11920, GITHUB#14706: Fix mock filesystem WindowsFS to also
+  work on Windows. This is required to make tests pass on Windows 11 which no
+  longer has all limitations of previous Windows versions.  (Uwe Schindler)
 
 
 ======================= Lucene 10.2.1 =======================
diff --git a/lucene/test-framework/src/test/org/apache/lucene/tests/mockfile/TestWindowsFS.java b/lucene/test-framework/src/test/org/apache/lucene/tests/mockfile/TestWindowsFS.java
index 48141b98e6f..8e6609fbe99 100644
--- a/lucene/test-framework/src/test/org/apache/lucene/tests/mockfile/TestWindowsFS.java
+++ b/lucene/test-framework/src/test/org/apache/lucene/tests/mockfile/TestWindowsFS.java
@@ -197,14 +197,16 @@ public class TestWindowsFS extends MockFileSystemTestCase {
     if (r.nextBoolean()) {
       // We need at least one char after the special char
       // For example, in case of '/' we interpret `foo/` to just be a file `foo` which is valid
+      // We need at least 2 chars before the special character, because resolving a drive
+      // letter (C:) or a path starting with "/" will not fail on real Windows.
       fileName =
-          RandomStrings.randomAsciiLettersOfLength(r, r.nextInt(10))
+          RandomStrings.randomAsciiLettersOfLength(r, r.nextInt(2, 10))
               + reservedCharacters[r.nextInt(reservedCharacters.length)]
               + RandomStrings.randomAsciiLettersOfLength(r, r.nextInt(1, 10));
     } else {
       fileName = reservedNames[r.nextInt(reservedNames.length)];
     }
-    expectThrows(InvalidPathException.class, () -> dir.resolve(fileName));
+    expectThrows(InvalidPathException.class, fileName, () -> dir.resolve(fileName));
 
     // some other basic tests
     expectThrows(InvalidPathException.class, () -> dir.resolve("foo:bar"));