Skip to content

Commit 9cd00d9

Browse files
committed
test(ssh): align pairing fixtures with current Effect services
1 parent 0ec994a commit 9cd00d9

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎packages/ssh/src/tunnel.test.ts‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
1010
import * as HostProcess from "@t3tools/shared/HostProcess";
1111
import * as NetService from "@t3tools/shared/Net";
1212
import * as Clock from "effect/Clock";
13+
import * as Config from "effect/Config";
1314
import * as Deferred from "effect/Deferred";
1415
import * as Duration from "effect/Duration";
1516
import * as Effect from "effect/Effect";
@@ -29,7 +30,12 @@ import { ChildProcess, ChildProcessSpawner } from "effect/process";
2930

3031
import * as SshAuth from "./auth.ts";
3132
import { remoteStateKey } from "./command.ts";
32-
import { SshCommandError, SshPairingError, SshPasswordPromptError, SshReadinessError } from "./errors.ts";
33+
import {
34+
SshCommandError,
35+
SshPairingError,
36+
SshPasswordPromptError,
37+
SshReadinessError,
38+
} from "./errors.ts";
3339
import * as SshTunnel from "./tunnel.ts";
3440

3541
const isSshCommandError = Schema.is(SshCommandError);
@@ -294,6 +300,7 @@ describe("ssh tunnel scripts", () => {
294300
const credential = mode === "archive" ? `paired-${serverVersion}` : "paired-dev";
295301
const fs = yield* FileSystem.FileSystem;
296302
const localSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
303+
const path = yield* Config.String("PATH").pipe(Config.withDefault(""));
297304
const home = yield* fs.makeTempDirectoryScoped({ prefix: "t3-ssh-pairing-" });
298305
for (const version of [serverVersion, ARCHIVE.archiveVersion]) {
299306
const runtime = `${home}/.t3/runtime/versions/${version}`;
@@ -345,7 +352,7 @@ describe("ssh tunnel scripts", () => {
345352
if (script.includes("PAIRING_BASE_DIR=")) {
346353
return yield* localSpawner.spawn(
347354
ChildProcess.make("sh", ["-s"], {
348-
env: { HOME: home, PATH: process.env.PATH ?? "" },
355+
env: { HOME: home, PATH: path },
349356
stdin: {
350357
stream: Stream.make(new TextEncoder().encode(script)),
351358
endOnDone: true,
@@ -394,7 +401,10 @@ describe("ssh tunnel scripts", () => {
394401
),
395402
Effect.scoped,
396403
);
397-
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
404+
}).pipe(
405+
Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)),
406+
Effect.scoped,
407+
),
398408
);
399409
});
400410

@@ -454,6 +464,7 @@ describe("ssh tunnel scripts", () => {
454464
Effect.provide(
455465
Layer.mergeAll(
456466
NodeServices.layer,
467+
NodeCrypto.layer,
457468
Layer.succeed(ChildProcessSpawner.ChildProcessSpawner, spawner),
458469
Layer.succeed(HttpClient.HttpClient, testHttpClient),
459470
Layer.succeed(NetService.NetService, testNetService),

0 commit comments

Comments
 (0)