Skip to content

Commit 5e2cbd9

Browse files
committed
test(server): the git-ssh wrapper's fake SSH script is a fixture file, not a generated string
Signed-off-by: Yordis Prieto <[email protected]>
1 parent 60a56f1 commit 5e2cbd9

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,7 +2216,9 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
22162216
const fileSystem = yield* FileSystem.FileSystem;
22172217
const pathService = yield* Path.Path;
22182218
const sshLogPath = pathService.join(tempDir, "ssh-env.txt");
2219-
const sshWrapperPath = pathService.join(tempDir, "ssh-wrapper.sh");
2219+
const sshWrapperPath = yield* pathService.fromFileUrl(
2220+
new URL("./testing/GitVcsDriverCore.fixture.sh", import.meta.url),
2221+
);
22202222
const envKeys = [
22212223
"GCM_INTERACTIVE",
22222224
"GIT_ASKPASS",
@@ -2228,20 +2230,6 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
22282230
] as const;
22292231
const previousEnv = new Map(envKeys.map((key) => [key, process.env[key]]));
22302232

2231-
yield* fileSystem.writeFileString(
2232-
sshWrapperPath,
2233-
[
2234-
"#!/bin/sh",
2235-
'printf "GCM_INTERACTIVE=%s\\n" "${GCM_INTERACTIVE:-}" > "$T3_TEST_SSH_ASKPASS_LOG"',
2236-
'printf "GIT_ASKPASS=%s\\n" "${GIT_ASKPASS:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"',
2237-
'printf "GIT_TERMINAL_PROMPT=%s\\n" "${GIT_TERMINAL_PROMPT:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"',
2238-
'printf "SSH_ASKPASS=%s\\n" "${SSH_ASKPASS:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"',
2239-
'printf "SSH_ASKPASS_REQUIRE=%s\\n" "${SSH_ASKPASS_REQUIRE:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"',
2240-
"exit 1",
2241-
"",
2242-
].join("\n"),
2243-
);
2244-
yield* fileSystem.chmod(sshWrapperPath, 0o755);
22452233
yield* git(cwd, ["remote", "add", "origin", "ssh://example.invalid/repo.git"]);
22462234
yield* git(cwd, ["update-ref", `refs/remotes/origin/${initialBranch}`, "HEAD"]);
22472235
yield* git(cwd, ["branch", "--set-upstream-to", `origin/${initialBranch}`]);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
printf "GCM_INTERACTIVE=%s\n" "${GCM_INTERACTIVE:-}" > "$T3_TEST_SSH_ASKPASS_LOG"
3+
printf "GIT_ASKPASS=%s\n" "${GIT_ASKPASS:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"
4+
printf "GIT_TERMINAL_PROMPT=%s\n" "${GIT_TERMINAL_PROMPT:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"
5+
printf "SSH_ASKPASS=%s\n" "${SSH_ASKPASS:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"
6+
printf "SSH_ASKPASS_REQUIRE=%s\n" "${SSH_ASKPASS_REQUIRE:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"
7+
exit 1

0 commit comments

Comments
 (0)