Skip to content

Commit 0a3010f

Browse files
glasstigerclaude
andcommitted
Fix Windows separator mismatch in SlotLockTest
testLogicalLockReportsLockDirectoryCreationFailure built the lock directory path with Paths.get(parentDir, ".slot-locks"), which yields a backslash separator on Windows. SlotLock.acquireLogical builds it as parentDir + "/" + ".slot-locks" (forward slash), so the injected LockDirectoryFailureFacade -- which fails mkdir only when lockDir.equals(path) -- never matched the production path on Windows. The mkdir then succeeded, acquireLogical did not throw, and the test hit its fail() guard. It passed on Linux and macOS only because Paths.get uses a forward slash there. Build the test's lock-dir (and slot) path with the same "/" concatenation SlotLock uses, so the facade matches on every platform. Test-only change; no production behavior is affected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 75d89b8 commit 0a3010f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • core/src/test/java/io/questdb/client/test/cutlass/qwp/client/sf/cursor

core/src/test/java/io/questdb/client/test/cutlass/qwp/client/sf/cursor/SlotLockTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,14 @@ public void testLogicalLockRejectsInvalidPaths() throws Exception {
144144
@Test
145145
public void testLogicalLockReportsLockDirectoryCreationFailure() throws Exception {
146146
TestUtils.assertMemoryLeak(() -> {
147-
String slot = Paths.get(parentDir, "mkdir-failure").toString();
148-
String lockDir = Paths.get(parentDir, ".slot-locks").toString();
147+
String slot = parentDir + "/mkdir-failure";
148+
// Build the lock-dir path exactly as SlotLock.acquireLogical does
149+
// (parent + "/" + ".slot-locks"), NOT via Paths.get: on Windows
150+
// Paths.get yields a '\' separator, so the facade's lockDir.equals(path)
151+
// check never matched the production forward-slash path and the mkdir
152+
// failure was never injected -- the sole cause of the Windows-only
153+
// failure of this test.
154+
String lockDir = parentDir + "/.slot-locks";
149155
LockDirectoryFailureFacade ff = new LockDirectoryFailureFacade(lockDir);
150156
try {
151157
SlotLock.acquireLogical(ff, slot);

0 commit comments

Comments
 (0)