mirror of
https://github.com/stablyai/orca.git
synced 2026-10-18 16:03:17 +00:00
test: scope SSH relay mode oracle to POSIX
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user