Open History to see the last commit
1import * as NodeServices from "@effect/platform-node/NodeServices";
2import { assert, it } from "@effect/vitest";
3import * as Duration from "effect/Duration";
4import * as Effect from "effect/Effect";
5import * as FileSystem from "effect/FileSystem";
6import * as Layer from "effect/Layer";
7import * as Path from "effect/Path";
8import * as TestClock from "effect/testing/TestClock";
9import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner";
10
11import {
12 HostProcessArguments,
13 HostProcessEnvironment,
14 HostProcessExecutablePath,
15 HostProcessPlatform,
16} from "@t3tools/shared/hostProcess";
17
18import * as ServerConfig from "../config.ts";
19import * as ProcessRunner from "../processRunner.ts";
20import {
21 BOOT_SERVICE_UNIT_ENV,
22 BOOT_SERVICE_UNIT_FILE,
23 renderBootServiceUnit,
24} from "./bootService.ts";
25import * as SelfUpdate from "./selfUpdate.ts";
26
27const NODE_PATH = "/usr/local/bin/node";
28
29const eventuallyFileString = Effect.fn("test.eventuallyFileString")(function* (
30 filePath: string,
31 expected: string,
32) {
33 const fs = yield* FileSystem.FileSystem;
34 for (let iteration = 0; iteration < 1_000; iteration += 1) {
35 const contents = yield* fs.readFileString(filePath);
36 if (contents === expected) {
37 return;
38 }
39 // The rollback performs real filesystem I/O on a detached fiber, which
40 // advancing TestClock does not await.
41 yield* Effect.yieldNow;
42 }
43 return yield* Effect.die(new Error(`Expected file contents were not observed at ${filePath}.`));
44});
45
46const eventuallyTrue = Effect.fn("test.eventuallyTrue")(function* (predicate: () => boolean) {
47 for (let iteration = 0; iteration < 1_000; iteration += 1) {
48 if (predicate()) {
49 return;
50 }
51 yield* Effect.yieldNow;
52 }
53 return yield* Effect.die(new Error("Expected condition was not observed."));
54});
55
56interface RecordedCommand {
57 readonly command: string;
58 readonly args: ReadonlyArray<string>;
59}
60
61const makeRecordingRunnerLayer = (
62 commands: Array<RecordedCommand>,
63 options?: {
64 readonly failWhen?: ((command: string, args: ReadonlyArray<string>) => boolean) | undefined;
65 readonly stdoutFor?:
66 | ((command: string, args: ReadonlyArray<string>) => string | undefined)
67 | undefined;
68 },
69) =>
70 Layer.succeed(
71 ProcessRunner.ProcessRunner,
72 ProcessRunner.ProcessRunner.of({
73 run: (input) =>
74 Effect.sync(() => {
75 commands.push({ command: input.command, args: input.args });
76 const failed = options?.failWhen?.(input.command, input.args) === true;
77 const versionFromPath =
78 input.command === NODE_PATH && input.args[1] === "--version"
79 ? /[/\\]runtime[/\\]versions[/\\]([^/\\]+)/.exec(input.args[0] ?? "")?.[1]
80 : undefined;
81 return {
82 stdout:
83 options?.stdoutFor?.(input.command, input.args) ??
84 (versionFromPath === undefined ? "" : `t3 v${versionFromPath}\n`),
85 stderr: failed ? `${input.command} exploded` : "",
86 code: ChildProcessSpawner.ExitCode(failed ? 1 : 0),
87 timedOut: false,
88 stdoutTruncated: false,
89 stderrTruncated: false,
90 };
91 }),
92 }),
93 );
94
95const provideHostRefs = (input: {
96 readonly platform: NodeJS.Platform;
97 readonly env: NodeJS.ProcessEnv;
98 readonly entryPath: string;
99}) =>
100 Effect.provide(
101 Layer.mergeAll(
102 Layer.succeed(HostProcessPlatform, input.platform),
103 Layer.succeed(HostProcessEnvironment, input.env),
104 Layer.succeed(HostProcessExecutablePath, NODE_PATH),
105 Layer.succeed(HostProcessArguments, [NODE_PATH, input.entryPath, "serve"]),
106 ),
107 );
108
109it("recognizes published npm artifacts as swappable entry points", () => {
110 assert.isTrue(SelfUpdate.isPublishedCliEntry("/usr/local/lib/node_modules/t3/dist/bin.mjs"));
111 assert.isTrue(
112 SelfUpdate.isPublishedCliEntry("/home/theo/.npm/_npx/abc123/node_modules/t3/dist/bin.mjs"),
113 );
114 assert.isTrue(
115 SelfUpdate.isPublishedCliEntry(
116 "C:\\Users\\theo\\AppData\\Roaming\\npm\\node_modules\\t3\\dist\\bin.mjs",
117 ),
118 );
119 // Dev checkouts and the desktop bundle run apps/server/dist directly.
120 assert.isFalse(SelfUpdate.isPublishedCliEntry("/home/theo/dev/t3/apps/server/dist/bin.mjs"));
121 assert.isFalse(SelfUpdate.isPublishedCliEntry(""));
122});
123
124it.layer(NodeServices.layer)("resolveServerSelfUpdateCapability", (it) => {
125 const makeHome = Effect.fn("test.makeHome")(function* () {
126 const fs = yield* FileSystem.FileSystem;
127 const path = yield* Path.Path;
128 const home = yield* fs.makeTempDirectoryScoped({ prefix: "t3-self-update-test-" });
129 return { fs, path, home };
130 });
131
132 const writeUnitReferencing = Effect.fn("test.writeUnitReferencing")(function* (
133 home: string,
134 entryPath: string,
135 ) {
136 const fs = yield* FileSystem.FileSystem;
137 const path = yield* Path.Path;
138 const unitDir = path.join(home, ".config", "systemd", "user");
139 yield* fs.makeDirectory(unitDir, { recursive: true });
140 yield* fs.writeFileString(
141 path.join(unitDir, "t3code.service"),
142 renderBootServiceUnit({
143 nodePath: NODE_PATH,
144 t3EntryPath: entryPath,
145 baseDir: path.join(home, ".t3"),
146 logPath: path.join(home, ".t3", "userdata", "logs", "boot-service.log"),
147 unitPath: path.join(unitDir, "t3code.service"),
148 }),
149 );
150 });
151
152 it.effect("reports boot-service for the systemd-spawned unit process", () =>
153 Effect.gen(function* () {
154 const { home, path } = yield* makeHome();
155 const entryPath = path.join(home, ".t3/runtime/versions/0.0.28/node_modules/t3/dist/bin.mjs");
156 yield* writeUnitReferencing(home, entryPath);
157 const method = yield* SelfUpdate.resolveServerSelfUpdateCapability({
158 desktopManaged: false,
159 }).pipe(
160 provideHostRefs({
161 platform: "linux",
162 env: {
163 HOME: home,
164 INVOCATION_ID: "abc123",
165 [BOOT_SERVICE_UNIT_ENV]: BOOT_SERVICE_UNIT_FILE,
166 },
167 entryPath,
168 }),
169 );
170 assert.equal(method, "boot-service");
171 }),
172 );
173
174 it.effect("does not claim a systemd process owned by another unit", () =>
175 Effect.gen(function* () {
176 const { home, path } = yield* makeHome();
177 const entryPath = path.join(home, ".t3/runtime/versions/0.0.28/node_modules/t3/dist/bin.mjs");
178 yield* writeUnitReferencing(home, entryPath);
179 const method = yield* SelfUpdate.resolveServerSelfUpdateCapability({
180 desktopManaged: false,
181 }).pipe(
182 provideHostRefs({
183 platform: "linux",
184 env: { HOME: home, INVOCATION_ID: "abc123" },
185 entryPath,
186 }),
187 );
188 assert.isNull(method);
189 }),
190 );
191
192 it.effect("reports respawn for a manual run of the pinned artifact", () =>
193 Effect.gen(function* () {
194 const { home, path } = yield* makeHome();
195 const entryPath = path.join(home, ".t3/runtime/versions/0.0.28/node_modules/t3/dist/bin.mjs");
196 yield* writeUnitReferencing(home, entryPath);
197 // Same unit on disk, but no INVOCATION_ID: restarting the unit would
198 // not replace this process, so it must respawn itself instead.
199 const method = yield* SelfUpdate.resolveServerSelfUpdateCapability({
200 desktopManaged: false,
201 }).pipe(provideHostRefs({ platform: "linux", env: { HOME: home }, entryPath }));
202 assert.equal(method, "respawn");
203 }),
204 );
205
206 it.effect("reports respawn for a foreground npx artifact on darwin", () =>
207 Effect.gen(function* () {
208 const { home } = yield* makeHome();
209 const method = yield* SelfUpdate.resolveServerSelfUpdateCapability({
210 desktopManaged: false,
211 }).pipe(
212 provideHostRefs({
213 platform: "darwin",
214 env: { HOME: home },
215 entryPath: `${home}/.npm/_npx/abc123/node_modules/t3/dist/bin.mjs`,
216 }),
217 );
218 assert.equal(method, "respawn");
219 }),
220 );
221
222 it.effect("reports desktop-managed for desktop-supervised backends", () =>
223 Effect.gen(function* () {
224 const { home, path } = yield* makeHome();
225 // Desktop ownership wins over every process-shape heuristic: even a
226 // systemd-looking pinned artifact belongs to the app that spawned it.
227 const entryPath = path.join(home, ".t3/runtime/versions/0.0.28/node_modules/t3/dist/bin.mjs");
228 yield* writeUnitReferencing(home, entryPath);
229 const method = yield* SelfUpdate.resolveServerSelfUpdateCapability({
230 desktopManaged: true,
231 }).pipe(
232 provideHostRefs({
233 platform: "linux",
234 env: {
235 HOME: home,
236 INVOCATION_ID: "abc123",
237 [BOOT_SERVICE_UNIT_ENV]: BOOT_SERVICE_UNIT_FILE,
238 },
239 entryPath,
240 }),
241 );
242 assert.equal(method, "desktop-managed");
243 }),
244 );
245
246 it.effect("reports no method for dev checkouts and Windows", () =>
247 Effect.gen(function* () {
248 const { home } = yield* makeHome();
249 const devMethod = yield* SelfUpdate.resolveServerSelfUpdateCapability({
250 desktopManaged: false,
251 }).pipe(
252 provideHostRefs({
253 platform: "darwin",
254 env: { HOME: home },
255 entryPath: `${home}/dev/t3/apps/server/dist/bin.mjs`,
256 }),
257 );
258 assert.isNull(devMethod);
259 const windowsMethod = yield* SelfUpdate.resolveServerSelfUpdateCapability({
260 desktopManaged: false,
261 }).pipe(
262 provideHostRefs({
263 platform: "win32",
264 env: { HOME: home },
265 entryPath: "C:\\Users\\theo\\AppData\\Roaming\\npm\\node_modules\\t3\\dist\\bin.mjs",
266 }),
267 );
268 assert.isNull(windowsMethod);
269 }),
270 );
271});
272
273it.layer(NodeServices.layer)("ServerSelfUpdate.update", (it) => {
274 interface RecordedSpawn {
275 readonly command: string;
276 readonly args: ReadonlyArray<string>;
277 }
278
279 const makeContext = Effect.fn("test.makeContext")(function* (options?: {
280 readonly platform?: NodeJS.Platform;
281 readonly bootService?: boolean;
282 readonly desktopManaged?: boolean;
283 readonly entryPath?: string;
284 readonly failWhen?: (command: string, args: ReadonlyArray<string>) => boolean;
285 readonly stdoutFor?: (command: string, args: ReadonlyArray<string>) => string | undefined;
286 readonly failSpawn?: boolean;
287 }) {
288 const fs = yield* FileSystem.FileSystem;
289 const path = yield* Path.Path;
290 const home = yield* fs.makeTempDirectoryScoped({ prefix: "t3-self-update-test-" });
291 const baseDir = path.join(home, ".t3");
292 const entryPath =
293 options?.entryPath ??
294 path.join(home, ".t3/runtime/versions/0.0.28/node_modules/t3/dist/bin.mjs");
295 const env: NodeJS.ProcessEnv =
296 options?.bootService === true
297 ? {
298 HOME: home,
299 INVOCATION_ID: "abc123",
300 [BOOT_SERVICE_UNIT_ENV]: BOOT_SERVICE_UNIT_FILE,
301 }
302 : { HOME: home };
303 if (options?.bootService === true) {
304 const unitDir = path.join(home, ".config", "systemd", "user");
305 yield* fs.makeDirectory(unitDir, { recursive: true });
306 yield* fs.writeFileString(
307 path.join(unitDir, "t3code.service"),
308 renderBootServiceUnit({
309 nodePath: NODE_PATH,
310 t3EntryPath: entryPath,
311 baseDir,
312 logPath: path.join(baseDir, "userdata", "logs", "boot-service.log"),
313 unitPath: path.join(unitDir, "t3code.service"),
314 }),
315 );
316 }
317
318 const commands: Array<RecordedCommand> = [];
319 const spawns: Array<RecordedSpawn> = [];
320 let exited = 0;
321 // layerTest always reports mode "web"; desktop-managed contexts overlay
322 // the mode the desktop app's bootstrap envelope would set.
323 const configLayer =
324 options?.desktopManaged === true
325 ? Layer.effect(
326 ServerConfig.ServerConfig,
327 Effect.gen(function* () {
328 const config = yield* ServerConfig.ServerConfig;
329 return { ...config, mode: "desktop" as const };
330 }),
331 ).pipe(Layer.provide(ServerConfig.layerTest(home, baseDir)))
332 : ServerConfig.layerTest(home, baseDir);
333 const service = yield* SelfUpdate.make({
334 host: {
335 spawnDetached: (command, args) =>
336 Effect.sync(() => spawns.push({ command, args })).pipe(
337 Effect.andThen(
338 options?.failSpawn === true
339 ? Effect.fail(
340 new ProcessRunner.ProcessSpawnError({
341 command,
342 argumentCount: args.length,
343 cause: new Error("detached spawn failed"),
344 }),
345 )
346 : Effect.void,
347 ),
348 ),
349 exitProcess: () => {
350 exited += 1;
351 },
352 },
353 }).pipe(
354 Effect.provide(
355 Layer.mergeAll(
356 makeRecordingRunnerLayer(commands, {
357 failWhen: options?.failWhen,
358 stdoutFor: options?.stdoutFor,
359 }),
360 configLayer,
361 ),
362 ),
363 provideHostRefs({ platform: options?.platform ?? "linux", env, entryPath }),
364 );
365 return {
366 fs,
367 path,
368 home,
369 baseDir,
370 entryPath,
371 commands,
372 spawns,
373 exitCount: () => exited,
374 service,
375 };
376 });
377
378 it.effect("rejects dist-tags and other non-exact versions", () =>
379 Effect.gen(function* () {
380 const context = yield* makeContext();
381 const error = yield* context.service.update({ targetVersion: "latest" }).pipe(Effect.flip);
382 assert.include(error.reason, "not an exact t3 version");
383 assert.lengthOf(context.commands, 0);
384 }),
385 );
386
387 it.effect("refuses to update a desktop-managed backend and points at the app", () =>
388 Effect.gen(function* () {
389 const context = yield* makeContext({ desktopManaged: true, bootService: true });
390 const error = yield* context.service.update({ targetVersion: "0.0.29" }).pipe(Effect.flip);
391 assert.include(error.reason, "desktop app");
392 assert.lengthOf(context.commands, 0);
393 assert.lengthOf(context.spawns, 0);
394 }),
395 );
396
397 it.effect("fails without touching anything when no update method applies", () =>
398 Effect.gen(function* () {
399 const context = yield* makeContext({
400 entryPath: "/home/theo/dev/t3/apps/server/dist/bin.mjs",
401 });
402 const error = yield* context.service.update({ targetVersion: "0.0.29" }).pipe(Effect.flip);
403 assert.include(error.reason, "cannot update itself");
404 assert.lengthOf(context.commands, 0);
405 }),
406 );
407
408 it.effect("surfaces a failed npm install and never schedules a restart", () =>
409 Effect.gen(function* () {
410 const context = yield* makeContext({ failWhen: (command) => command === "npm" });
411 const error = yield* context.service.update({ targetVersion: "0.0.29" }).pipe(Effect.flip);
412 assert.equal(error.reason, "Could not install the requested t3 version.");
413 yield* TestClock.adjust(Duration.seconds(10));
414 assert.lengthOf(context.spawns, 0);
415 assert.equal(context.exitCount(), 0);
416 }).pipe(Effect.provide(TestClock.layer())),
417 );
418
419 it.effect("reinstalls the same version after a failed preflight", () =>
420 Effect.gen(function* () {
421 let preflightAttempts = 0;
422 const context = yield* makeContext({
423 failWhen: (command) => {
424 if (command !== NODE_PATH) return false;
425 preflightAttempts += 1;
426 return preflightAttempts === 1;
427 },
428 });
429 const versionDir = context.path.join(context.baseDir, "runtime", "versions", "0.0.29");
430 const entryPath = context.path.join(versionDir, "node_modules", "t3", "dist", "bin.mjs");
431 yield* context.fs.makeDirectory(context.path.dirname(entryPath), { recursive: true });
432 yield* context.fs.writeFileString(entryPath, "export {};\n");
433 yield* context.fs.writeFileString(
434 context.path.join(versionDir, ".install-complete"),
435 "0.0.29\n",
436 );
437
438 const firstError = yield* context.service
439 .update({ targetVersion: "0.0.29" })
440 .pipe(Effect.flip);
441 assert.include(firstError.reason, "failed its version check");
442 assert.isFalse(yield* context.fs.exists(versionDir));
443
444 const result = yield* context.service.update({ targetVersion: "0.0.29" });
445 assert.deepEqual(result, { targetVersion: "0.0.29", method: "respawn" });
446 assert.deepEqual(
447 context.commands.map((entry) => entry.command),
448 [NODE_PATH, "npm", NODE_PATH],
449 );
450 }).pipe(Effect.provide(TestClock.layer())),
451 );
452
453 it.effect("rejects and removes an installed runtime that reports the wrong version", () =>
454 Effect.gen(function* () {
455 const context = yield* makeContext({
456 stdoutFor: (command, args) =>
457 command === NODE_PATH && args[1] === "--version" ? "t3 v0.0.28\n" : undefined,
458 });
459 const versionDir = context.path.join(context.baseDir, "runtime", "versions", "0.0.29");
460
461 const error = yield* context.service.update({ targetVersion: "0.0.29" }).pipe(Effect.flip);
462
463 assert.include(error.reason, "did not report the requested");
464 assert.isFalse(yield* context.fs.exists(versionDir));
465 assert.lengthOf(context.spawns, 0);
466 }),
467 );
468
469 it.effect("reports a detached replacement spawn failure and leaves updates retryable", () =>
470 Effect.gen(function* () {
471 const context = yield* makeContext({ failSpawn: true });
472
473 const first = yield* context.service.update({ targetVersion: "0.0.29" }).pipe(Effect.flip);
474 assert.include(first.reason, "Could not start the replacement");
475
476 const second = yield* context.service.update({ targetVersion: "0.0.29" }).pipe(Effect.flip);
477 assert.include(second.reason, "Could not start the replacement");
478 assert.notInclude(second.reason, "already in progress");
479 assert.lengthOf(context.spawns, 2);
480 assert.equal(context.exitCount(), 0);
481 }),
482 );
483
484 it.effect("installs, preflights, and respawns a foreground server", () =>
485 Effect.gen(function* () {
486 const context = yield* makeContext();
487 const progress: Array<string> = [];
488 const result = yield* context.service.update({ targetVersion: "0.0.29" }, (stage) =>
489 Effect.sync(() => progress.push(stage)),
490 );
491 assert.deepEqual(result, { targetVersion: "0.0.29", method: "respawn" });
492 assert.deepEqual(progress, ["downloading", "installing"]);
493 assert.lengthOf(context.spawns, 1);
494
495 const concurrentError = yield* context.service
496 .update({ targetVersion: "0.0.30" })
497 .pipe(Effect.flip);
498 assert.include(concurrentError.reason, "already in progress");
499
500 const pinnedEntry = context.path.join(
501 context.baseDir,
502 "runtime/versions/0.0.29/node_modules/t3/dist/bin.mjs",
503 );
504 assert.deepEqual(
505 context.commands.map((entry) => [entry.command, ...entry.args].join(" ")),
506 [
507 `npm install --prefix ${context.path.join(context.baseDir, "runtime/versions/0.0.29")} --no-fund --no-audit t3@0.0.29`,
508 `${NODE_PATH} ${pinnedEntry} --version`,
509 ],
510 );
511
512 // The restart is deferred so the RPC acknowledgement flushes first.
513 yield* TestClock.adjust(Duration.seconds(10));
514 assert.lengthOf(context.spawns, 1);
515 const spawn = context.spawns[0];
516 assert.equal(spawn?.command, "/bin/sh");
517 assert.include(spawn?.args ?? [], pinnedEntry);
518 // The replacement replays the original CLI arguments.
519 assert.include(spawn?.args ?? [], "serve");
520 assert.equal(context.exitCount(), 1);
521 }).pipe(Effect.provide(TestClock.layer())),
522 );
523
524 it.effect("rewrites the systemd unit and restarts the boot service", () =>
525 Effect.gen(function* () {
526 const context = yield* makeContext({ bootService: true });
527 const result = yield* context.service.update({ targetVersion: "0.0.29" });
528 assert.deepEqual(result, { targetVersion: "0.0.29", method: "boot-service" });
529
530 const pinnedEntry = context.path.join(
531 context.baseDir,
532 "runtime/versions/0.0.29/node_modules/t3/dist/bin.mjs",
533 );
534 const unit = yield* context.fs.readFileString(
535 context.path.join(context.home, ".config", "systemd", "user", "t3code.service"),
536 );
537 assert.include(unit, `ExecStart=${NODE_PATH} ${pinnedEntry} serve`);
538 assert.deepEqual(
539 context.commands.map((entry) => entry.command),
540 ["npm", NODE_PATH, "systemctl"],
541 );
542 assert.deepEqual(context.commands[2]?.args, ["--user", "daemon-reload"]);
543
544 // Restart waits until after the update acknowledgement can flush.
545 yield* TestClock.adjust(Duration.seconds(10));
546 assert.deepEqual(context.commands[3], {
547 command: "systemctl",
548 args: ["--user", "restart", "t3code.service"],
549 });
550 assert.lengthOf(context.spawns, 0);
551 // systemd replaces the process; the server must not exit itself.
552 assert.equal(context.exitCount(), 0);
553 }).pipe(Effect.provide(TestClock.layer())),
554 );
555
556 it.effect("restores the previous unit and permits a retry when systemd restart fails", () =>
557 Effect.gen(function* () {
558 let failRestart = true;
559 const context = yield* makeContext({
560 bootService: true,
561 failWhen: (command, args) => {
562 if (command !== "systemctl" || args[1] !== "restart" || !failRestart) {
563 return false;
564 }
565 failRestart = false;
566 return true;
567 },
568 });
569 const unitPath = context.path.join(
570 context.home,
571 ".config",
572 "systemd",
573 "user",
574 BOOT_SERVICE_UNIT_FILE,
575 );
576 const previousUnit = yield* context.fs.readFileString(unitPath);
577
578 const first = yield* context.service.update({ targetVersion: "0.0.29" });
579 assert.deepEqual(first, { targetVersion: "0.0.29", method: "boot-service" });
580 yield* TestClock.adjust(Duration.seconds(10));
581 yield* eventuallyFileString(unitPath, previousUnit);
582 yield* eventuallyTrue(() => context.commands.at(-1)?.args[1] === "daemon-reload");
583 assert.deepEqual(
584 context.commands.slice(-2).map((entry) => entry.args),
585 [
586 ["--user", "restart", BOOT_SERVICE_UNIT_FILE],
587 ["--user", "daemon-reload"],
588 ],
589 );
590
591 const retry = yield* context.service.update({ targetVersion: "0.0.30" });
592 assert.deepEqual(retry, { targetVersion: "0.0.30", method: "boot-service" });
593 }).pipe(Effect.provide(TestClock.layer())),
594 );
595
596 it.effect("restores the previous systemd unit when daemon-reload fails", () =>
597 Effect.gen(function* () {
598 const context = yield* makeContext({
599 bootService: true,
600 failWhen: (command) => command === "systemctl",
601 });
602 const unitPath = context.path.join(
603 context.home,
604 ".config",
605 "systemd",
606 "user",
607 BOOT_SERVICE_UNIT_FILE,
608 );
609 const previousUnit = yield* context.fs.readFileString(unitPath);
610
611 const error = yield* context.service.update({ targetVersion: "0.0.29" }).pipe(Effect.flip);
612 assert.include(error.reason, "Reloading systemd units failed");
613 assert.equal(yield* context.fs.readFileString(unitPath), previousUnit);
614 assert.deepEqual(
615 context.commands.map((entry) => entry.command),
616 ["npm", NODE_PATH, "systemctl", "systemctl"],
617 );
618
619 yield* TestClock.adjust(Duration.seconds(10));
620 assert.lengthOf(context.spawns, 0);
621 assert.equal(context.exitCount(), 0);
622 }).pipe(Effect.provide(TestClock.layer())),
623 );
624});