From c85fdef6a3cde661306fd487ded782ebd42cc900 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Sat, 7 Nov 2026 16:59:20 +0000 Subject: [PATCH] test(devcontainer): run fake-Docker importer tests only on Linux (#3835) - Address PR review feedback: on macOS the importer passes container UID 1000, and the fake Docker adapter ran finishSnapshot's chown as the unprivileged host user. The adapter emulates the Linux helper container on the host, so its seven tests now share a `linuxHelper` gate; the bash, mode and FIFO tests keep the narrower `posixOnly`. Co-Authored-By: Claude Opus 5.5 --- .devcontainer/initialize-volumes.test.cjs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.devcontainer/initialize-volumes.test.cjs b/.devcontainer/initialize-volumes.test.cjs index 71d1c6091..ca141755d 100644 --- a/.devcontainer/initialize-volumes.test.cjs +++ b/.devcontainer/initialize-volumes.test.cjs @@ -26,9 +26,12 @@ async function tarBuffer(source, entries) { } const posixOnly = { + skip: process.platform === 'win32' && 'needs POSIX tooling: bash, file modes, mkfifo', +}; +const linuxHelper = { skip: - process.platform === 'win32' && - 'needs POSIX tooling: shebang Docker adapter, Linux helper commands, bash, modes, mkfifo', + process.platform !== 'linux' && + 'fake Docker adapter runs Linux helper commands (chown to the container UID, find, tar) as the host user', }; test('the host tar omits dependencies and parser caches while preserving indexes and local files', async (t) => { @@ -311,7 +314,7 @@ switch(args[0]) { test( 'host import is one-time, uses only native volumes, preserves edits and cleans its helper', - posixOnly, + linuxHelper, (t) => { const { source, home, state, run } = dockerFixture(t); const first = run(); @@ -366,7 +369,7 @@ test( test( 'reopening a pre-volume container restages, so the eventual rebuild commits current work', - posixOnly, + linuxHelper, (t) => { const { source, home, state, run } = dockerFixture(t); assert.equal(run().status, 0); // Old container reopened: stage only, nothing commits. @@ -390,7 +393,7 @@ test( }, ); -test('archive progress continues while Docker finishes a slow copy', posixOnly, (t) => { +test('archive progress continues while Docker finishes a slow copy', linuxHelper, (t) => { const { run } = dockerFixture(t); const result = run('source', { IMPORT_SLOW_COPY: '1' }); assert.equal(result.status, 0, result.stderr); @@ -403,7 +406,7 @@ test('archive progress continues while Docker finishes a slow copy', posixOnly, test( 'native profile imports config without copying or requiring a host checkout', - posixOnly, + linuxHelper, (t) => { const { source, state, run } = dockerFixture(t); fs.rmSync(source, { recursive: true }); @@ -414,7 +417,7 @@ test( }, ); -test('a failed stage never blocks reopening and can never be committed', posixOnly, (t) => { +test('a failed stage never blocks reopening and can never be committed', linuxHelper, (t) => { const { state, run } = dockerFixture(t); const result = run('source', { IMPORT_FAIL_COPY: '1' }); assert.equal(result.status, 0, result.stderr); // A busy host must not lock out a reopen. @@ -433,7 +436,7 @@ test('a failed stage never blocks reopening and can never be committed', posixOn assert.equal(fs.readFileSync(path.join(state, 'workspace/local-edit'), 'utf8'), 'uncommitted'); }); -test('an existing importer is never removed by a competing initialization', posixOnly, (t) => { +test('an existing importer is never removed by a competing initialization', linuxHelper, (t) => { const { state, run } = dockerFixture(t); fs.writeFileSync(path.join(state, 'active'), 'other importer'); const result = run(); @@ -442,7 +445,7 @@ test('an existing importer is never removed by a competing initialization', posi assert.doesNotMatch(fs.readFileSync(path.join(state, 'commands'), 'utf8'), /\["rm"/); }); -test('failed symlink restoration never publishes a complete stage', posixOnly, (t) => { +test('failed symlink restoration never publishes a complete stage', linuxHelper, (t) => { const { state, run } = dockerFixture(t); const result = run('source', { IMPORT_FAIL_LINKS: '1' }); assert.equal(result.status, 0, result.stderr);