fix: docker-config test - set MCP_MODE=http for detached container

Root cause: Same issue as docker-entrypoint.test.ts - test was starting
container in detached mode without setting MCP_MODE. The node application
defaulted to stdio mode, which expects JSON-RPC input on stdin. In detached
Docker mode, stdin is /dev/null, causing the process to receive EOF and exit
immediately.

When the test tried to check /proc/1/environ after 2 seconds to verify
NODE_DB_PATH from config file, PID 1 no longer existed, causing the test
to fail with "container is not running".

Solution: Add MCP_MODE=http and AUTH_TOKEN=test to the docker run command
so the HTTP server starts and keeps the container running, allowing the test
to verify that NODE_DB_PATH is correctly set from the config file.

This fixes the last failing CI test:
- Before: 678 passed | 1 failed | 27 skipped
- After: 679 passed | 0 failed | 27 skipped 

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-10-10 10:33:31 +02:00
parent f61fd9b429
commit b8227ff775

View File

@@ -269,8 +269,9 @@ describeDocker('Docker Config File Integration', () => {
fs.writeFileSync(configPath, JSON.stringify(config));
// Run container in detached mode to check environment after initialization
// Set MCP_MODE=http so the server keeps running (stdio mode exits when stdin is closed in detached mode)
await exec(
`docker run -d --name ${containerName} -v "${configPath}:/app/config.json:ro" ${imageName}`
`docker run -d --name ${containerName} -e MCP_MODE=http -e AUTH_TOKEN=test -v "${configPath}:/app/config.json:ro" ${imageName}`
);
// Give it time to load config and start