diff --git a/packages/eval/src/__tests__/install-preflight.test.ts b/packages/eval/src/__tests__/install-preflight.test.ts index 50fb43e9a3..c7be16f9c0 100644 --- a/packages/eval/src/__tests__/install-preflight.test.ts +++ b/packages/eval/src/__tests__/install-preflight.test.ts @@ -1,5 +1,5 @@ import assert from 'node:assert/strict'; -import { chmod, mkdtemp, mkdir, rm, symlink, writeFile } from 'node:fs/promises'; +import { chmod, mkdtemp, mkdir, realpath, rm, symlink, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { test } from 'node:test'; @@ -13,11 +13,13 @@ test('preflights the pinned Python framework and Docker before execution', async t.after(() => rm(root, { recursive: true, force: true })); const trials = join(root, 'trials'); const mount = join(root, 'mount'); + const egressTarget = join(root, 'egress-target'); const egress = join(root, 'egress'); - await Promise.all([mkdir(trials), mkdir(mount), mkdir(egress)]); + await Promise.all([mkdir(trials), mkdir(mount), mkdir(egressTarget)]); + await symlink(egressTarget, egress, process.platform === 'win32' ? 'junction' : 'dir'); await Promise.all([ - writeFile(join(egress, 'compose.yaml'), 'services: {}\n'), - writeFile(join(egress, 'network-policy.json'), '{}\n'), + writeFile(join(egressTarget, 'compose.yaml'), 'services: {}\n'), + writeFile(join(egressTarget, 'network-policy.json'), '{}\n'), ]); const restore = setMachinePaths({ MAKA_TEST_PREFLIGHT_PYTHON: process.execPath, @@ -46,10 +48,10 @@ test('preflights the pinned Python framework and Docker before execution', async assert.equal(calls[0]?.environment.MAKA_TEST_PREFLIGHT_SECRET, undefined); assert.equal(calls[0]?.environment.MAKA_EVAL_EGRESS_REQUIRED, '1'); assert.equal(calls[0]?.environment.MAKA_EVAL_EGRESS_ALLOWED_HOST, 'api.example.test'); - assert.equal( - calls[0]?.environment.MAKA_EVAL_NETWORK_POLICY_PATH, - join(egress, 'network-policy.json'), - ); + const networkPolicyPath = join(egress, 'network-policy.json'); + const canonicalNetworkPolicyPath = await realpath(networkPolicyPath); + assert.notEqual(canonicalNetworkPolicyPath, networkPolicyPath); + assert.equal(calls[0]?.environment.MAKA_EVAL_NETWORK_POLICY_PATH, canonicalNetworkPolicyPath); assert.deepEqual(calls[1], { command: 'docker', args: ['version', '--format', '{{.Server.Version}}'],