Commit 60668ae
fix(test): portable MkdirAll-failure path for Windows (#101)
* fix(test): portable MkdirAll-failure path for Windows
TestWriteIDExclusive_mkdirFailure passed `/dev/null/impossible/path/id`
expecting MkdirAll to fail because `/dev/null` is a char-device file.
That's only true on POSIX — on Windows there is no `/dev/null`, so
MkdirAll happily creates `C:\dev\null\impossible\path\` and the test
failed.
Switch to a portable trick: create a regular file in t.TempDir(), then
pass `<that-file>/impossible/id` as the path. Every OS treats a
regular file as a non-directory and refuses to descend into it
(POSIX: ENOTDIR, Windows: ERROR_DIRECTORY). MkdirAll returns
non-nil either way, which is the contract the test pins.
No production code change — the writeIDExclusive function itself
behaves correctly on both platforms; only the test setup was
platform-specific.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: bump version to 0.17.3 for Windows test hotfix
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0b7d0c8 commit 60668ae
3 files changed
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1064 | 1064 | | |
1065 | 1065 | | |
1066 | 1066 | | |
1067 | | - | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
1068 | 1083 | | |
1069 | | - | |
| 1084 | + | |
1070 | 1085 | | |
1071 | 1086 | | |
1072 | 1087 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
0 commit comments