Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ test('installer atomically publishes a read-only trusted control plane', async (
const installer = path.join(loopRoot, 'scripts', 'install-trusted-control-plane.mjs')
const target = path.join(fixtureRoot, 'trusted-control-plane')
const canonicalTarget = path.join(await realpath(fixtureRoot), 'trusted-control-plane')
const executableRoot = path.join(fixtureRoot, 'bin')
const fixtureGh = path.join(executableRoot, 'gh')
await Promise.all([
mkdir(path.dirname(installer), { recursive: true }),
mkdir(path.join(loopRoot, 'triggers'), { recursive: true }),
mkdir(path.join(repositoryRoot, 'loops', '_shared', 'owner-channel'), { recursive: true }),
mkdir(executableRoot),
])
await Promise.all([
cp(installerSource, installer),
Expand All @@ -75,6 +78,7 @@ test('installer atomically publishes a read-only trusted control plane', async (
'{}\n',
'utf8',
),
writeFile(fixtureGh, '#!/bin/sh\nexit 0\n', { encoding: 'utf8', mode: 0o755 }),
])

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

const { stdout } = await execFileAsync(process.execPath, [installer, '--target', target], {
cwd: repositoryRoot,
env: {
...process.env,
PATH: `${executableRoot}${path.delimiter}${process.env.PATH ?? ''}`,
},
})

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