fixed a failing test case on the server
This commit is contained in:
@@ -24,18 +24,20 @@ test("Docker Configuration: Dockerfile enforces Node runtime and excludes Nginx"
|
||||
assert.match(content, /CMD\s*\[\s*["']npm["']\s*,\s*["']start["']\s*\]/, "Dockerfile must start via npm start");
|
||||
});
|
||||
|
||||
test("Docker Configuration: docker-compose.yml configures Node service correctly", () => {
|
||||
const composePath = path.resolve(process.cwd(), "docker-compose.yml");
|
||||
assert.ok(fs.existsSync(composePath), "docker-compose.yml must exist");
|
||||
test("Docker Configuration: docker-compose configures Node service correctly", () => {
|
||||
const composePath = fs.existsSync(path.resolve(process.cwd(), "sample-docker-compose.yml"))
|
||||
? path.resolve(process.cwd(), "sample-docker-compose.yml")
|
||||
: path.resolve(process.cwd(), "docker-compose.yml");
|
||||
assert.ok(fs.existsSync(composePath), "Compose template file must exist");
|
||||
|
||||
const content = fs.readFileSync(composePath, "utf-8");
|
||||
|
||||
// Verifies dynamic port mapping and environment variables
|
||||
assert.match(content, /PORT:\s*\$\{PORT:-8080\}/, "docker-compose.yml must pass dynamic PORT build arg and env");
|
||||
assert.match(content, /PORT:\s*"?\$\{PORT:-8080\}"?/, "docker-compose.yml must pass dynamic PORT build arg and env");
|
||||
assert.match(content, /:\$\{PORT:-8080\}/, "docker-compose.yml must map dynamic container PORT");
|
||||
|
||||
// Verifies healthcheck targets dynamic port
|
||||
assert.match(content, /localhost:\$\{PORT:-8080\}\/healthz/, "Healthcheck must probe dynamic PORT on /healthz");
|
||||
assert.match(content, /(127\.0\.0\.1|localhost):\$\{PORT:-8080\}\/healthz/, "Healthcheck must probe dynamic PORT on /healthz");
|
||||
|
||||
// Verifies domain argument enforcement
|
||||
assert.match(content, /SITE_DOMAIN/, "docker-compose.yml must require SITE_DOMAIN");
|
||||
|
||||
Reference in New Issue
Block a user