mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 02:29:33 +01:00
test(docker): give the Update-Codeman.sh smoke harness a non-root appdata owner
Both Update-Codeman.sh and Start-Codeman.sh derive PUID:PGID from the CODEMAN_APPDATA_PATH owner and refuse a root-owned directory. The smoke harness created that directory with mkdirSync, so under a root test runner (CI or agent containers) it was owned 0:0 and the script exited at that guard before its `build --no-cache` and `down`, failing the default and --keep-volumes smoke tests with an empty build/down log. The guard is correct; the harness now chowns appdata to 99:100 (docker/README.md's own example) when running as root, matching a real deployment.
This commit is contained in:
1 parent
ecf28fa3be
commit
affe91d7ed
1 file changed
+8
-1
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
||||
import { readFileSync, mkdtempSync, rmSync, writeFileSync, mkdirSync } from 'node:fs';
|
||||
import { readFileSync, mkdtempSync, rmSync, writeFileSync, mkdirSync, chownSync } from 'node:fs';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
@@ -309,6 +309,13 @@ describe('Update-Codeman.sh (the scripted major-update path — docker/README.md
|
||||
const casesPath = join(dir, 'cases');
|
||||
const socketPath = join(dir, 'docker.sock'); // deliberately NOT a real socket — see above
|
||||
mkdirSync(appdataPath);
|
||||
// Both scripts derive PUID:PGID from the appdata owner and REFUSE a
|
||||
// root-owned one (correctly: the container must never run as root).
|
||||
// mkdirSync gives it the runner's uid, so under a root runner (a CI or
|
||||
// agent container) the update path stopped at that guard before its
|
||||
// build. Give it the non-root owner docker/README.md's own
|
||||
// `chown -R 99:100` example sets up, as a real deployment would have.
|
||||
if (process.getuid?.() === 0) chownSync(appdataPath, 99, 100);
|
||||
mkdirSync(casesPath);
|
||||
writeFileSync(socketPath, '');
|
||||
|
||||
|
||||
Reference in new issue
Block a user