Add tests for container subcommand argument validation #19

Open
opened 2025-11-19 13:20:48 +00:00 by glenux · 0 comments
Owner

title: Add tests for container subcommand argument validation
description: Ensure regression coverage for the repeated "Index out of bounds" errors when container subcommands lack required arguments (e.g., container pull, container save).
current_situation: DocMachine::Container::Cli shifts arguments without checks (src/container/cli.cr:53-80). Multiple user reports (pull, save) show the CLI crashing with the same stack trace. Task [5d8410b] will implement validation, but no automated tests exist to prevent future regressions.
expected_outcome:

  • Test suite runs docmachine container subcommands with missing args (pull/run/save/load) and asserts that friendly DocMachine::CliErrors are raised and usage/help text is displayed.
  • CI fails if someone removes the validation or reintroduces raw args.shift calls without guards.
  • Tests document expected error messages for each subcommand.
    technical_details:
  • Add specs/integration tests (e.g., in spec/container/cli_spec.cr or new integration harness) executing the CLI entrypoints.
  • Consider using Process.run("crystal", ["run", ...]) or refactor CLI to allow invoking DocMachine::Cli#start directly from tests with argument arrays.

--- title: Add tests for container subcommand argument validation description: Ensure regression coverage for the repeated "Index out of bounds" errors when container subcommands lack required arguments (e.g., `container pull`, `container save`). current_situation: `DocMachine::Container::Cli` shifts arguments without checks (src/container/cli.cr:53-80). Multiple user reports (`pull`, `save`) show the CLI crashing with the same stack trace. Task [5d8410b] will implement validation, but no automated tests exist to prevent future regressions. expected_outcome: - Test suite runs `docmachine container` subcommands with missing args (pull/run/save/load) and asserts that friendly `DocMachine::CliError`s are raised and usage/help text is displayed. - CI fails if someone removes the validation or reintroduces raw `args.shift` calls without guards. - Tests document expected error messages for each subcommand. technical_details: - Add specs/integration tests (e.g., in `spec/container/cli_spec.cr` or new integration harness) executing the CLI entrypoints. - Consider using `Process.run("crystal", ["run", ...])` or refactor CLI to allow invoking `DocMachine::Cli#start` directly from tests with argument arrays. ---
glenux changed title from fcd4b67 Add tests for container subcommand argument validation to Add tests for container subcommand argument validation 2025-11-19 13:26:33 +00:00
glenux added this to the By Status project 2025-11-19 18:02:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: glenux/docmachine-cli#19
No description provided.