@impz/testing 6.11.3 → 6.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +52 -20
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -21756,7 +21756,7 @@ var EnvSchema = z53.object({
|
|
|
21756
21756
|
IMP_KSM_HEADROOM_PERCENT: z53.string().default("100"),
|
|
21757
21757
|
IMP_HUGE_PAGES: z53.enum(["off", "2M"]).default("off"),
|
|
21758
21758
|
IMP_UFFD_HANDLER: z53.string().default("uffd-handler"),
|
|
21759
|
-
IMP_WARM_CAP_MIB: CountSchema3.default(
|
|
21759
|
+
IMP_WARM_CAP_MIB: CountSchema3.default(2048),
|
|
21760
21760
|
IMP_DNS: z53.string().default("1.1.1.1,8.8.8.8").transform(splitList).pipe(DnsServersSchema),
|
|
21761
21761
|
IMP_SUBNET: z53.cidrv4().default("10.66.0.0/16"),
|
|
21762
21762
|
IMP_SUBNET6: z53.string().default("auto"),
|
|
@@ -22009,7 +22009,7 @@ import { join as join48 } from "path";
|
|
|
22009
22009
|
// packages/daemon/package.json
|
|
22010
22010
|
var package_default = {
|
|
22011
22011
|
name: "@impz/daemon",
|
|
22012
|
-
version: "6.11.
|
|
22012
|
+
version: "6.11.5",
|
|
22013
22013
|
private: true,
|
|
22014
22014
|
description: "impd: the imp host daemon",
|
|
22015
22015
|
type: "module",
|
|
@@ -27666,7 +27666,7 @@ async function sendThaw(vsockPath) {
|
|
|
27666
27666
|
decodeAgentMessage(OKSchema, response);
|
|
27667
27667
|
}
|
|
27668
27668
|
function readFrameWithin(connection, wait) {
|
|
27669
|
-
return requireWithin(connection.next(), wait.timeoutMs, () => new AgentWaitError(`agent at ${wait.vsockPath} sent no ${wait.call} within ${String(wait.timeoutMs)} ms`));
|
|
27669
|
+
return requireWithin(connection.next(), wait.timeoutMs, () => new AgentWaitError(`agent at ${wait.vsockPath} sent no ${wait.call} within ${String(wait.timeoutMs)} ms`), wait.startTimer);
|
|
27670
27670
|
}
|
|
27671
27671
|
|
|
27672
27672
|
// packages/daemon/src/imps/imps/consistent-disk.ts
|
|
@@ -35146,7 +35146,7 @@ var PROXY_VARIABLE = "HTTPS_PROXY";
|
|
|
35146
35146
|
// packages/daemon/src/vm/agent-client/exec-stream.ts
|
|
35147
35147
|
import { isMessage as isMessage2 } from "@bufbuild/protobuf";
|
|
35148
35148
|
var EXEC_START_TIMEOUT_MS = 1e4;
|
|
35149
|
-
async function openExecStream(vsockPath, request, startTimeoutMs = EXEC_START_TIMEOUT_MS) {
|
|
35149
|
+
async function openExecStream(vsockPath, request, startTimeoutMs = EXEC_START_TIMEOUT_MS, startTimer = startRealTimer) {
|
|
35150
35150
|
const { argv, env, resumeFrom, outer, require: _checked, ...rest } = request;
|
|
35151
35151
|
const op = outer === true ? "exec.outer" : "exec";
|
|
35152
35152
|
const opening = openStream(vsockPath, {
|
|
@@ -35155,7 +35155,7 @@ async function openExecStream(vsockPath, request, startTimeoutMs = EXEC_START_TI
|
|
|
35155
35155
|
argv: [...argv],
|
|
35156
35156
|
...env !== undefined && { env: [...env] },
|
|
35157
35157
|
...resumeFrom !== undefined && { resumeFrom }
|
|
35158
|
-
}, startTimeoutMs);
|
|
35158
|
+
}, startTimeoutMs, startTimer);
|
|
35159
35159
|
const stream = await (outer === true ? opening.catch(handleUnknownOp("outer-exec")) : opening);
|
|
35160
35160
|
if (request.session !== undefined && stream.session === null) {
|
|
35161
35161
|
stream.close();
|
|
@@ -35178,7 +35178,7 @@ function openAttachStream(vsockPath, request, startTimeoutMs = EXEC_START_TIMEOU
|
|
|
35178
35178
|
...resumeFrom !== undefined && { resumeFrom }
|
|
35179
35179
|
}, startTimeoutMs).catch(handleUnknownOp("sessions"));
|
|
35180
35180
|
}
|
|
35181
|
-
async function openStream(vsockPath, request, startTimeoutMs) {
|
|
35181
|
+
async function openStream(vsockPath, request, startTimeoutMs, startTimer = startRealTimer) {
|
|
35182
35182
|
const connection = await openAgentConnection(vsockPath);
|
|
35183
35183
|
let started;
|
|
35184
35184
|
let output;
|
|
@@ -35187,7 +35187,8 @@ async function openStream(vsockPath, request, startTimeoutMs) {
|
|
|
35187
35187
|
const first = await readFrameWithin(connection, {
|
|
35188
35188
|
call: `${request.op} start`,
|
|
35189
35189
|
vsockPath,
|
|
35190
|
-
timeoutMs: startTimeoutMs
|
|
35190
|
+
timeoutMs: startTimeoutMs,
|
|
35191
|
+
startTimer
|
|
35191
35192
|
});
|
|
35192
35193
|
if (first === null) {
|
|
35193
35194
|
throw new Error("agent closed the exec connection before the process started");
|
|
@@ -39393,6 +39394,9 @@ function createPrioritySemaphore(limit) {
|
|
|
39393
39394
|
};
|
|
39394
39395
|
}
|
|
39395
39396
|
|
|
39397
|
+
// packages/daemon/src/platform/process/vm-deadlines.ts
|
|
39398
|
+
var VM_DEADLINES = { agentMs: 15000, killMs: 3000 };
|
|
39399
|
+
|
|
39396
39400
|
// packages/daemon/src/imp-ops/governor/build-budgets.ts
|
|
39397
39401
|
function buildBudgets(budgetMib, pool) {
|
|
39398
39402
|
return {
|
|
@@ -39590,7 +39594,7 @@ function createPriorityAdmissions(priority) {
|
|
|
39590
39594
|
}
|
|
39591
39595
|
|
|
39592
39596
|
// packages/daemon/src/imp-ops/governor/ram-governor.ts
|
|
39593
|
-
var RESERVATION_TTL_MS =
|
|
39597
|
+
var RESERVATION_TTL_MS = VM_DEADLINES.agentMs + 1e4;
|
|
39594
39598
|
var ENFORCE_INTERVAL_MS = 5000;
|
|
39595
39599
|
var ENFORCE_TRIGGER = "RAM over budget";
|
|
39596
39600
|
var ORDINARY_TRIGGER = "RAM outside the huge page pool";
|
|
@@ -42983,7 +42987,8 @@ function createImpContext(deps) {
|
|
|
42983
42987
|
const clock = {
|
|
42984
42988
|
now,
|
|
42985
42989
|
sleep: deps.sleep,
|
|
42986
|
-
sleepTiming: deps.sleepTiming
|
|
42990
|
+
sleepTiming: deps.sleepTiming,
|
|
42991
|
+
execStartTimer: deps.execStartTimer ?? startRealTimer
|
|
42987
42992
|
};
|
|
42988
42993
|
const vms = {
|
|
42989
42994
|
images: deps.images,
|
|
@@ -43863,6 +43868,7 @@ function startNewLogTap(context, imp, stream) {
|
|
|
43863
43868
|
|
|
43864
43869
|
// packages/daemon/src/imps/imps/imp-runtime.ts
|
|
43865
43870
|
var INNER_PING_TIMEOUT_MS = 1000;
|
|
43871
|
+
var BUILDER_EXEC_START_TIMEOUT_MS = 30000;
|
|
43866
43872
|
function createImpRuntime(parts) {
|
|
43867
43873
|
const context = parts.context;
|
|
43868
43874
|
const lock = parts.lock;
|
|
@@ -43980,7 +43986,7 @@ function createImpRuntime(parts) {
|
|
|
43980
43986
|
openBuilderExec: (name, request) => openStream({
|
|
43981
43987
|
name,
|
|
43982
43988
|
kind: "exec",
|
|
43983
|
-
open: (paths) => openExecStream(paths.vsockSocket, request),
|
|
43989
|
+
open: (paths) => openExecStream(paths.vsockSocket, request, BUILDER_EXEC_START_TIMEOUT_MS, context.execStartTimer),
|
|
43984
43990
|
wake: true,
|
|
43985
43991
|
isBuilderAllowed: true
|
|
43986
43992
|
}),
|
|
@@ -44649,9 +44655,6 @@ import { resolve as resolve3 } from "path";
|
|
|
44649
44655
|
// packages/daemon/src/vm/vmm/template-vm.ts
|
|
44650
44656
|
import { mkdirSync as mkdirSync15, rmSync as rmSync21 } from "fs";
|
|
44651
44657
|
|
|
44652
|
-
// packages/daemon/src/platform/process/vm-deadlines.ts
|
|
44653
|
-
var VM_DEADLINES = { agentMs: 15000, killMs: 3000 };
|
|
44654
|
-
|
|
44655
44658
|
// packages/daemon/src/vm/agent-client/wait-for-agent.ts
|
|
44656
44659
|
async function waitForAgent(vsockPath, options) {
|
|
44657
44660
|
const clock = options.clock ?? REAL_CLOCK;
|
|
@@ -47079,7 +47082,7 @@ async function copyBase(base, memFile) {
|
|
|
47079
47082
|
// packages/daemon/src/vm/vmm/vm-runner.ts
|
|
47080
47083
|
var SHUTDOWN_TIMEOUT_MS = 1e4;
|
|
47081
47084
|
var UFFD_WATCH_INTERVAL_MS = 100;
|
|
47082
|
-
var WAKE_AGENT_DEADLINE_MS =
|
|
47085
|
+
var WAKE_AGENT_DEADLINE_MS = VM_DEADLINES.agentMs;
|
|
47083
47086
|
var GUEST_MEMORY_TIMEOUTS = { requestMs: 1000, snapshotMs: 1000 };
|
|
47084
47087
|
var UPTIME_PING_TIMEOUT_MS = 250;
|
|
47085
47088
|
function createVmRunner(jails, options) {
|
|
@@ -47089,6 +47092,7 @@ function createVmRunner(jails, options) {
|
|
|
47089
47092
|
const createClient = options.createClient ?? createFirecrackerClient;
|
|
47090
47093
|
const readFile = options.readFile;
|
|
47091
47094
|
const uffdHandlerBin = options.uffdHandlerBin ?? null;
|
|
47095
|
+
const clock = options.clock ?? REAL_CLOCK;
|
|
47092
47096
|
const uffdWatch = createUffdWatch({
|
|
47093
47097
|
probeVmAlive: (pid, paths) => probeProcessAlive(pid, paths.apiSocket, procRoot),
|
|
47094
47098
|
readHandlerState: (paths) => readHandlerState(paths, procRoot),
|
|
@@ -47306,7 +47310,8 @@ ${readLogTail(plan.paths.logFile)}`, {
|
|
|
47306
47310
|
setMark("load");
|
|
47307
47311
|
const ping = await waitForAgent(plan.paths.vsockSocket, {
|
|
47308
47312
|
deadlineMs: WAKE_AGENT_DEADLINE_MS,
|
|
47309
|
-
attemptMs: 200
|
|
47313
|
+
attemptMs: 200,
|
|
47314
|
+
clock
|
|
47310
47315
|
});
|
|
47311
47316
|
setMark("agent");
|
|
47312
47317
|
await sendResumed(plan.paths.vsockSocket, Date.now());
|
|
@@ -47388,7 +47393,8 @@ ${readLogTail(plan.paths.logFile, 5)}`, {
|
|
|
47388
47393
|
finishWake: async (paths) => {
|
|
47389
47394
|
const ping = await waitForAgent(paths.vsockSocket, {
|
|
47390
47395
|
deadlineMs: WAKE_AGENT_DEADLINE_MS,
|
|
47391
|
-
attemptMs: 200
|
|
47396
|
+
attemptMs: 200,
|
|
47397
|
+
clock
|
|
47392
47398
|
});
|
|
47393
47399
|
await sendResumed(paths.vsockSocket, Date.now());
|
|
47394
47400
|
const firecrackerVersion = await createClient(paths.apiSocket).readVersion();
|
|
@@ -47582,7 +47588,10 @@ function resolveImpBoundaries(boundaries) {
|
|
|
47582
47588
|
readNetBytes: boundaries.readNetBytes ?? ((tap) => readGuestNetBytes(tap)),
|
|
47583
47589
|
readHostLoad: boundaries.readHostLoad ?? (() => readHostLoad({ procRoot: "/proc", readFile: readText, logger: getImpdLogger("imps") })),
|
|
47584
47590
|
...boundaries.openTap !== undefined && { openTap: boundaries.openTap },
|
|
47585
|
-
...boundaries.now !== undefined && { now: boundaries.now }
|
|
47591
|
+
...boundaries.now !== undefined && { now: boundaries.now },
|
|
47592
|
+
...boundaries.execStartTimer !== undefined && {
|
|
47593
|
+
execStartTimer: boundaries.execStartTimer
|
|
47594
|
+
}
|
|
47586
47595
|
};
|
|
47587
47596
|
}
|
|
47588
47597
|
function makeStandInVmRam(readRam) {
|
|
@@ -49995,7 +50004,7 @@ class GuestOutputError extends Error {
|
|
|
49995
50004
|
function createGuestExec(open, startTimer = startRealTimer) {
|
|
49996
50005
|
return async (argv, options) => {
|
|
49997
50006
|
options.signal.throwIfAborted();
|
|
49998
|
-
const stream = await open({ argv: [...argv], tty: false, user: "0" });
|
|
50007
|
+
const stream = await openUntilAborted(open({ argv: [...argv], tty: false, user: "0" }), options.signal);
|
|
49999
50008
|
if (options.signal.aborted) {
|
|
50000
50009
|
stream.close();
|
|
50001
50010
|
options.signal.throwIfAborted();
|
|
@@ -50055,6 +50064,27 @@ function createGuestExec(open, startTimer = startRealTimer) {
|
|
|
50055
50064
|
}
|
|
50056
50065
|
};
|
|
50057
50066
|
}
|
|
50067
|
+
async function openUntilAborted(opening, signal) {
|
|
50068
|
+
const aborted = Promise.withResolvers();
|
|
50069
|
+
const rejectOnAbort = () => {
|
|
50070
|
+
aborted.reject(signal.reason);
|
|
50071
|
+
};
|
|
50072
|
+
signal.addEventListener("abort", rejectOnAbort, { once: true });
|
|
50073
|
+
try {
|
|
50074
|
+
return await Promise.race([opening, aborted.promise]);
|
|
50075
|
+
} catch (error) {
|
|
50076
|
+
if (signal.aborted) {
|
|
50077
|
+
closeOnceOpen(opening);
|
|
50078
|
+
}
|
|
50079
|
+
throw error;
|
|
50080
|
+
} finally {
|
|
50081
|
+
signal.removeEventListener("abort", rejectOnAbort);
|
|
50082
|
+
}
|
|
50083
|
+
}
|
|
50084
|
+
async function closeOnceOpen(opening) {
|
|
50085
|
+
const stream = await opening.catch(() => null);
|
|
50086
|
+
stream?.close();
|
|
50087
|
+
}
|
|
50058
50088
|
async function sendStdin(stream, path, signal) {
|
|
50059
50089
|
try {
|
|
50060
50090
|
for await (const chunk of Bun.file(path).stream()) {
|
|
@@ -50094,7 +50124,8 @@ function pickRandomBuilderName() {
|
|
|
50094
50124
|
return `imp-build-${[...picks].map((pick) => NAME_ALPHABET2[pick % NAME_ALPHABET2.length]).join("")}`;
|
|
50095
50125
|
}
|
|
50096
50126
|
async function waitForEngine(exec, signal, clock) {
|
|
50097
|
-
const
|
|
50127
|
+
const startedMs = clock.now();
|
|
50128
|
+
const deadline = startedMs + ENGINE_READY_MS;
|
|
50098
50129
|
for (;; ) {
|
|
50099
50130
|
const info = await exec(["docker", "info", "--format", "{{.ServerVersion}}"], {
|
|
50100
50131
|
signal,
|
|
@@ -50109,8 +50140,9 @@ async function waitForEngine(exec, signal, clock) {
|
|
|
50109
50140
|
return;
|
|
50110
50141
|
}
|
|
50111
50142
|
if (clock.now() > deadline) {
|
|
50143
|
+
const waitedS = Math.floor((clock.now() - startedMs) / 1000);
|
|
50112
50144
|
const log = await readEngineLog(exec, signal);
|
|
50113
|
-
throw new Error(`the builder's engine did not answer in ${String(
|
|
50145
|
+
throw new Error(`the builder's engine did not answer in ${String(waitedS)} s: ${info.stderr.trim()}${log}`);
|
|
50114
50146
|
}
|
|
50115
50147
|
await clock.sleep(ENGINE_POLL_MS);
|
|
50116
50148
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impz/testing",
|
|
3
|
-
"version": "6.11.
|
|
3
|
+
"version": "6.11.5",
|
|
4
4
|
"description": "A real impd on stand-ins, for Bun tests of code that drives impd through @impz/client",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"ts-pattern": "^5.9.2",
|
|
44
44
|
"xstate": "^5.33.3",
|
|
45
45
|
"zod": "^4.6.7",
|
|
46
|
-
"@impz/client": "6.11.
|
|
46
|
+
"@impz/client": "6.11.5"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"bun": ">=1.4.3"
|