Skip to content

Commit ca208a2

Browse files
test(file-safety)(Zoo-Code-Org#1918 u159): compare the staging parent on the footing the writer resolves
The windows arm of platform-unit-test fails on one row at fcd9500: services/file-safety/__tests__/safeWriteText.stagingDacl.spec.ts:226 compared path.dirname(observation.stagingDirAtNarrow) -- a name the writer resolved -- with the fixture parent's unresolved spelling. The runner hands os.tmpdir() in its 8.3 short form (C:\Users\RUNNER~1\... where the resolved path reads C:\Users\runneradmin\...), so the row was deciding a directory question by a spelling question. Locally the same row reddens under a mis-cased TEMP and passes under a canonical one, with and without the change below. The assertion now reads both sides through realpathSync.native, the OS-level resolution whose output the writer's canonicalization reports on Windows, so the row states which directory holds the staging directory instead of which spelling each side arrived in. Six comment lines added, one executable line changed in place; nothing outside __tests__ moved.
1 parent fcd9500 commit ca208a2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎src/services/file-safety/__tests__/safeWriteText.stagingDacl.spec.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,14 @@ describe("staging directory access rights on a real NTFS volume", () => {
223223
// own staging directory with a full-control grant to the account the process runs as.
224224
expect(observation.calls[0]).toContain("/inheritance:r")
225225
expect(observation.calls[0]).toContain(".file-safety-staging")
226-
expect(path.dirname(observation.stagingDirAtNarrow)).toBe(fixture.parent)
226+
// The staging directory is the one the writer resolved, and the writer resolves the name it
227+
// was given: on a hosted windows runner the temporary root arrives in its 8.3 short form
228+
// (a log there reads `C:\Users\RUNNER~1\...` where the resolved path reads
229+
// `C:\Users\runneradmin\...`), and a locally constructed root can differ in case alone. The
230+
// row is about which directory holds the staging directory, so it compares the two through
231+
// the same OS-level resolution the writer's canonicalization reports (realpathSync.native),
232+
// which is one directory on a machine where the two spellings name the same directory.
233+
expect(path.dirname(observation.stagingDirAtNarrow)).toBe(fsSync.realpathSync.native(fixture.parent))
227234
expect(observation.calls[0]).toMatch(/:\(OI\)\(CI\)\(F\)$/)
228235
expect(observation.calls[0]).toContain(account)
229236

0 commit comments

Comments
 (0)