test: scope SSH relay mode oracle to POSIX

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo-H
2026-07-16 09:30:05 -04:00
co-authored by Orca
parent 59997b1383
commit df39c287d6
3 changed files with 93 additions and 16 deletions
@@ -319,10 +319,6 @@ describe('SSH relay runtime bounded source stream', () => {
(metadata) => Object.assign(Object.create(metadata), { isSymbolicLink: () => true })
],
['wrong type', (metadata) => Object.assign(Object.create(metadata), { isFile: () => false })],
[
'wrong mode',
(metadata) => Object.assign(Object.create(metadata), { mode: metadata.mode ^ 1n })
],
[
'state drift',
(metadata) => Object.assign(Object.create(metadata), { mtimeNs: metadata.mtimeNs + 1n })
@@ -347,6 +343,31 @@ describe('SSH relay runtime bounded source stream', () => {
expect(openDestination).not.toHaveBeenCalled()
})
it.skipIf(process.platform === 'win32')(
'rejects POSIX mode metadata before destination creation',
async () => {
const { tree } = await sourceStreamFixture()
const target = tree.files[0].localPath
const openDestination = vi.fn()
await expect(
streamSshRelayRuntimeSourceTree(
{ tree, signal: new AbortController().signal, openDestination },
{
lstat: async (path) => {
const metadata = (await lstat(path, {
bigint: true
})) as SshRelayRuntimeSourceMetadata
return path === target
? Object.assign(Object.create(metadata), { mode: metadata.mode ^ 1n })
: metadata
}
}
)
).rejects.toThrow(/mode/i)
expect(openDestination).not.toHaveBeenCalled()
}
)
it('rejects source mutation before destination creation', async () => {
const { tree } = await sourceStreamFixture()
const openDestination = vi.fn()