Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Fix remaining porter CI failures

Josh France28778e568186
diff --git a/src/sandbox/porter-sandbox.ts b/src/sandbox/porter-sandbox.ts
index 50fd9fbe5..f9355346a 100644
--- a/src/sandbox/porter-sandbox.ts
+++ b/src/sandbox/porter-sandbox.ts
@@ -58,8 +58,6 @@ const SCOPE_TAG = "qm-scope";
const KIND_TAG = "qm-kind";
const DEFAULT_PORTER_SANDBOX_IMAGE = "ghcr.io/porter-dev/qm-sandbox:latest";
-export type { PorterClientLike, PorterSandboxLike } from "./porter-client.ts";
-
interface BodyEntry {
name: string;
sb: PorterSandboxLike;
diff --git a/test/porter-deploy-provider.test.ts b/test/porter-deploy-provider.test.ts
index 90f201355..0287e452d 100644
--- a/test/porter-deploy-provider.test.ts
+++ b/test/porter-deploy-provider.test.ts
@@ -17,6 +17,7 @@ const SERVER = [
"const fs = require('fs');",
"console.log('server starting');",
"require('http').createServer((q, s) => {",
+ " s.setHeader('connection', 'close');",
" if (q.url === '/data') return s.end(fs.readFileSync(process.env.DATA_DIR + '/note.txt', 'utf8'));",
" s.end('hello from ' + process.cwd() + ' v' + (process.env.APP_VERSION ?? '?'));",
"}).listen(process.env.PORT);",
@@ -74,7 +75,7 @@ function make(extra: { terminateLag?: number; resolveCacheMs?: number } = {}): v
appsDomain: "apps.test",
namePrefix: "qmt",
appPort,
- readyWindowSec: 3,
+ readyWindowSec: 10,
resolveCacheMs: extra.resolveCacheMs ?? 0,
client: fake.client,
store,
@@ -243,7 +244,7 @@ test("without an apps domain the cluster-assigned hostname becomes the URL", asy
const bare = createPorterDeployProvider({
namePrefix: "qmt",
appPort,
- readyWindowSec: 3,
+ readyWindowSec: 10,
client: fake.client,
store,
});
diff --git a/test/support/fake-porter.ts b/test/support/fake-porter.ts
index b8594009e..f3cadfd3c 100644
--- a/test/support/fake-porter.ts
+++ b/test/support/fake-porter.ts
@@ -1,4 +1,4 @@
-import { spawnSync } from "node:child_process";
+import { spawn, spawnSync } from "node:child_process";
import { mkdtempSync, mkdirSync, rmSync, existsSync, readFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
@@ -204,15 +204,21 @@ export function installFakePorter(opts: FakePorterOptions = {}): FakePorter {
const script = body.command[body.command.length - 1] ?? "";
execScripts.push(script);
mkdirSync(cur.tmp, { recursive: true });
- const r = spawnSync("sh", ["-c", remap(cur, script)], {
- encoding: "buffer",
- maxBuffer: 128 * 1024 * 1024,
+ const child = spawn("sh", ["-c", remap(cur, script)], {
env: { ...process.env, ...cur.env, COPYFILE_DISABLE: "1" },
});
+ const stdout: Buffer[] = [];
+ const stderr: Buffer[] = [];
+ child.stdout.on("data", (chunk: Buffer) => stdout.push(chunk));
+ child.stderr.on("data", (chunk: Buffer) => stderr.push(chunk));
+ const [code, sig] = await new Promise<[number | null, NodeJS.Signals | null]>((resolve, reject) => {
+ child.on("error", reject);
+ child.on("close", (c, s) => resolve([c, s]));
+ });
return {
- stdout: (r.stdout ?? Buffer.alloc(0)).toString("utf8"),
- stderr: (r.stderr ?? Buffer.alloc(0)).toString("utf8"),
- exit_code: r.status ?? (r.signal ? 137 : -1),
+ stdout: Buffer.concat(stdout).toString("utf8"),
+ stderr: Buffer.concat(stderr).toString("utf8"),
+ exit_code: code ?? (sig ? 137 : -1),
};
},
},