Inventory smoke tests can hang despite command timeout; fail with bounded diagnostics

Abierto
#1,569 0 comentarios 1 reacción 2 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@rjaegers ya está trabajando en esto.

Desde el 12/11/2026.

  • #1570 de @copilot-swe-agent — abierto

Evaluación

Este issue todavía no se ha evaluado.

Descripción

Problem

assert_inventory_tools_run can leave an integration-test job waiting until its job-level timeout instead of producing a failed Bats test when a command hangs.

The helper already runs each command with:

run timeout --kill-after=5s 30s "${tool}" "${args[@]}" < /dev/null

However, this does not bound the observed end-to-end execution of the Bats test in the reproduction below. Increasing the workflow timeout is not the desired fix: a stalled smoke command should fail promptly with an actionable diagnostic.

Observed reproduction

Observed using the bats-tool-inventory helper shipped in the v9.1.0 image (same implementation in actions/v2.3.2), with NuGet 2.8.7 and the JUnit formatter:

{
  "packages": {
    "nuget": {
      "commands": ["nuget"],
      "smoke-test-args": {"nuget": ["help"]}
    }
  }
}
#!/usr/bin/env bats

setup() {
  bats_load_library bats-support
  bats_load_library bats-assert
  bats_load_library bats-tool-inventory
}

@test "inventory commands start successfully" {
  assert_inventory_tools_run "${BATS_TEST_DIRNAME}/inventory.json"
}

Run the test without an interactive terminal:

bats --formatter junit smoke.bats

Observed behavior:

  • nuget help hangs when stdin is /dev/null and output is redirected/captured. It finishes when run through a pseudo-terminal.
  • A direct outer timeout can stop the NuGet invocation, but the Bats inventory test did not return after the helper's nominal 30-second timeout plus five-second kill grace.
  • A local reproduction needed an outer 90-second timeout to stop Bats. The JUnit output had no completed test case.
  • Integration jobs on both amd64 and arm64 remained in the test step for approximately 20 minutes, until the job timeout. No actionable failed-test report was available.
  • Changing the NuGet smoke invocation to nuget config -NonInteractive made the inventory smoke test finish in approximately six seconds locally. This is a caller-side workaround, not a general timeout fix.

The exact mechanism remains unconfirmed. Please investigate process-tree cleanup, inherited file descriptors/output capture, and whether excessive output can prevent Bats from completing after the command timeout. These are hypotheses, not established causes.

Expected behavior

A hung command should result in a bounded, ordinary failed test, not a workflow cancellation:

  • Report the package, escaped command/arguments, timeout duration and exit status, explicitly identifying a timeout.
  • Include useful bounded output without allowing excessive output to exhaust memory or stall failure reporting.
  • Terminate and reap the command and its descendants; do not leave captured streams or inherited descriptors preventing test completion.
  • Emit a complete JUnit failure and allow the workflow to upload the report before its job timeout.
  • Keep successful smoke tests and custom smoke-test-args behavior unchanged.

Suggested acceptance coverage

Exercise the real Bats runner and JUnit formatter, not only a stub that makes timeout return 124:

  1. A command that blocks indefinitely.
  2. A command that ignores TERM and requires forced termination.
  3. A command that spawns a child retaining stdout/stderr (and any relevant Bats descriptors).
  4. A command that produces excessive output while hanging.
  5. A normal successful command and a nonzero command exit, preserving their existing diagnostics.

Use short test deadlines and assert bounded completion, no surviving child processes, and a complete failed JUnit test case naming the offending command. Consider a suite/test-level safeguard as well as the per-command timeout, but ensure it cannot itself leave a watchdog process or inherited descriptor keeping Bats alive.

Relevant implementation

Lenguaje dominante
Shell
Estrellas
136
Forks
8
Merge medio
17 h 19 min
PR fusionados (30 d)
53

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de philips-software/amp-devcontainer

Todos los issues de philips-software/amp-devcontainer

Issues similares

Más issues de Shell/Bash

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.