Skip to content

Commit 8edc975

Browse files
committed
test(loop): isolate installer gh dependency
1 parent 376f838 commit 8edc975

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

loops/issue-dev-loop/tests/install-trusted-control-plane.test.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ test('installer atomically publishes a read-only trusted control plane', async (
6262
const installer = path.join(loopRoot, 'scripts', 'install-trusted-control-plane.mjs')
6363
const target = path.join(fixtureRoot, 'trusted-control-plane')
6464
const canonicalTarget = path.join(await realpath(fixtureRoot), 'trusted-control-plane')
65+
const executableRoot = path.join(fixtureRoot, 'bin')
66+
const fixtureGh = path.join(executableRoot, 'gh')
6567
await Promise.all([
6668
mkdir(path.dirname(installer), { recursive: true }),
6769
mkdir(path.join(loopRoot, 'triggers'), { recursive: true }),
6870
mkdir(path.join(repositoryRoot, 'loops', '_shared', 'owner-channel'), { recursive: true }),
71+
mkdir(executableRoot),
6972
])
7073
await Promise.all([
7174
cp(installerSource, installer),
@@ -75,6 +78,7 @@ test('installer atomically publishes a read-only trusted control plane', async (
7578
'{}\n',
7679
'utf8',
7780
),
81+
writeFile(fixtureGh, '#!/bin/sh\nexit 0\n', { encoding: 'utf8', mode: 0o755 }),
7882
])
7983

8084
await git(repositoryRoot, ['init', '--initial-branch=dev'])
@@ -94,6 +98,10 @@ test('installer atomically publishes a read-only trusted control plane', async (
9498

9599
const { stdout } = await execFileAsync(process.execPath, [installer, '--target', target], {
96100
cwd: repositoryRoot,
101+
env: {
102+
...process.env,
103+
PATH: `${executableRoot}${path.delimiter}${process.env.PATH ?? ''}`,
104+
},
97105
})
98106

99107
const result = JSON.parse(stdout)
@@ -111,4 +119,5 @@ test('installer atomically publishes a read-only trusted control plane', async (
111119
)
112120
assert.equal(manifest.bundleRoot, canonicalTarget)
113121
assert.equal(manifest.sourceCommit, sourceCommit)
122+
assert.equal(manifest.executables.gh, await realpath(fixtureGh))
114123
})

0 commit comments

Comments
 (0)