Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions packages/harness/src/sandboxes/daytona/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,9 @@ const providerFrom = (sandbox: RemoteSandbox, options: Options) => {
throw cause;
}
},
// `createFolder` is `mkdir -p`; plain `mkdir` fails on a missing parent.
mkdir: async (path: string, mkdirOptions?: { recursive?: boolean }) => {
if (!mkdirOptions?.recursive) {
await sandbox.fs.createFolder(path, "755");
return;
}

const command = `mkdir -p ${quote(path)}`;
const command = mkdirOptions?.recursive ? `mkdir -p ${quote(path)}` : `mkdir ${quote(path)}`;
const result = await sandbox.process.executeCommand(command, options.cwd, undefined, options.execTimeout);
assertCommandSucceeded(command, result);
},
Expand All @@ -234,8 +230,9 @@ const providerFrom = (sandbox: RemoteSandbox, options: Options) => {
try {
await sandbox.fs.deleteFile(path, rmOptions?.recursive);
} catch (cause) {
if (rmOptions?.force && !(await filesystem.exists(path))) return;
throw cause;
if (await filesystem.exists(path)) throw cause;
if (rmOptions?.force) return;
throw Object.assign(enoent("rm", path), { cause });
}
},
realpath: async (path: string) => {
Expand Down
154 changes: 154 additions & 0 deletions packages/harness/test/__artifacts__/sandbox.conformance.daytona.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
{
"driver": "daytona",
"declared": {
"combinesOutput": true,
"cancels": false,
"inheritsHostEnv": false
},
"cases": {
"write": {
"utf8": "héllo\nwörld\n🚀",
"overwritten": "second",
"nested": "data",
"parent": true
},
"read-errors": {
"missing": "not-found",
"directory": "SandboxFileSystemError"
},
"bytes": {
"buffer": true,
"head": [
0,
1,
2,
3
],
"middle": [
254,
255,
0,
1
],
"end": [
42,
43
],
"past": 0,
"missing": "not-found"
},
"scan": {
"mismatches": [],
"missing": "not-found"
},
"stat": {
"file": {
"isFile": true,
"isDirectory": false,
"size": 4
},
"dir": {
"isFile": false,
"isDirectory": true
},
"linked": 0,
"link": {
"isFile": true,
"isSymbolicLink": false
},
"lstat": {
"file": false,
"link": true
},
"missing": "not-found"
},
"dirs": {
"entries": [
".hidden",
"a.txt",
"sub"
],
"readdirMissing": "not-found",
"exists": {
"root": true,
"file": true,
"dir": true,
"missing": false,
"missingNested": false
},
"mkdirWithoutParent": "SandboxFileSystemError"
},
"rm": {
"file": false,
"nonEmpty": "SandboxFileSystemError",
"tree": false,
"missing": "not-found",
"forced": "ok"
},
"paths": {
"cwd": "<cwd>",
"absolute": "resolved",
"normalised": "resolved",
"pastRoot": "resolved",
"pastRootRelative": "resolved"
},
"shared": {
"fromFs": "filesystem",
"fromShell": "shell",
"overwritten": "overwritten"
},
"exit": {
"ok": {
"exitCode": 0,
"stdout": "ok",
"stderr": ""
},
"failed": {
"exitCode": 7,
"stdout": "outerr",
"stderr": ""
},
"literal": "two words;$(echo pwned)"
},
"env": {
"scoped": "scoped",
"after": "",
"host": ""
},
"cwd": {
"pwd": "<cwd>",
"argvPwd": "<cwd>",
"override": "<cwd>/<scratch>",
"argvOverride": "<cwd>/<scratch>",
"read": "cwd content",
"after": "<cwd>",
"root": "<cwd>/<scratch>"
},
"vocabulary": {
"compound": "step1\nstep2\n",
"pipe": "3",
"redirect": "redirected",
"find": "3",
"uname": "as declared"
},
"output": {
"exitCode": 0,
"lines": 20000,
"first": "1",
"last": "20000"
},
"timeout": {
"error": {
"_tag": "ToolShellTimeout",
"millis": 200
},
"prompt": true
},
"pre-interrupted": {
"started": false
},
"interrupt": {
"stopped": false
}
}
}
154 changes: 154 additions & 0 deletions packages/harness/test/__artifacts__/sandbox.conformance.host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
{
"driver": "host",
"declared": {
"combinesOutput": false,
"cancels": true,
"inheritsHostEnv": true
},
"cases": {
"write": {
"utf8": "héllo\nwörld\n🚀",
"overwritten": "second",
"nested": "data",
"parent": true
},
"read-errors": {
"missing": "not-found",
"directory": "SandboxFileSystemError"
},
"bytes": {
"buffer": true,
"head": [
0,
1,
2,
3
],
"middle": [
254,
255,
0,
1
],
"end": [
42,
43
],
"past": 0,
"missing": "not-found"
},
"scan": {
"mismatches": [],
"missing": "not-found"
},
"stat": {
"file": {
"isFile": true,
"isDirectory": false,
"size": 4
},
"dir": {
"isFile": false,
"isDirectory": true
},
"linked": 0,
"link": {
"isFile": true,
"isSymbolicLink": false
},
"lstat": {
"file": false,
"link": true
},
"missing": "not-found"
},
"dirs": {
"entries": [
".hidden",
"a.txt",
"sub"
],
"readdirMissing": "not-found",
"exists": {
"root": true,
"file": true,
"dir": true,
"missing": false,
"missingNested": false
},
"mkdirWithoutParent": "SandboxFileSystemError"
},
"rm": {
"file": false,
"nonEmpty": "SandboxFileSystemError",
"tree": false,
"missing": "not-found",
"forced": "ok"
},
"paths": {
"cwd": "<cwd>",
"absolute": "resolved",
"normalised": "resolved",
"pastRoot": "resolved",
"pastRootRelative": "resolved"
},
"shared": {
"fromFs": "filesystem",
"fromShell": "shell",
"overwritten": "overwritten"
},
"exit": {
"ok": {
"exitCode": 0,
"stdout": "ok",
"stderr": ""
},
"failed": {
"exitCode": 7,
"stdout": "out",
"stderr": "err"
},
"literal": "two words;$(echo pwned)"
},
"env": {
"scoped": "scoped",
"after": "",
"host": "harness-process"
},
"cwd": {
"pwd": "<cwd>",
"argvPwd": "<cwd>",
"override": "<cwd>/<scratch>",
"argvOverride": "<cwd>/<scratch>",
"read": "cwd content",
"after": "<cwd>",
"root": "<cwd>/<scratch>"
},
"vocabulary": {
"compound": "step1\nstep2\n",
"pipe": "3",
"redirect": "redirected",
"find": "3",
"uname": "as declared"
},
"output": {
"exitCode": 0,
"lines": 20000,
"first": "1",
"last": "20000"
},
"timeout": {
"error": {
"_tag": "ToolShellTimeout",
"millis": 200
},
"prompt": true
},
"pre-interrupted": {
"started": false
},
"interrupt": {
"stopped": true
}
}
}
Loading
Loading