Skip to content

Add RecordingRunner and Execute() test suite #363

@kindermax

Description

@kindermax

Parent

#355

What to build

Create a RecordingRunner test helper (satisfies the ScriptRunner seam from #362) that captures every script invocation — the script text, the env slice, and the working directory — and can be configured to return controlled errors on specific calls.

Using RecordingRunner, write a comprehensive table-driven test suite against Executor.Execute(). The test file lives in package executor (same package, internal access) and uses only the standard testing library — no third-party assertion frameworks.

Tests to cover:

  • Init script runs on the first Execute() call and is skipped on subsequent calls
  • Dependencies execute in declaration order
  • A dependency failure returns a DependencyError with the correct command chain
  • Sequential command scripts execute in order
  • after script is invoked even when the main command script fails
  • after script error does not override the main command's exit code
  • Parallel mode dispatches all command scripts (order-independent)
  • A failure in one parallel script causes Execute() to return an error
  • LETS_CHECKSUM_* env vars are present in the runner invocation when a checksum is defined
  • Checksum is persisted after a successful execution
  • Checksum is not persisted when a command script fails

Acceptance criteria

  • RecordingRunner captures script, env, and dir per invocation and supports returning controlled errors
  • Test covers: init runs once across multiple Execute() calls
  • Test covers: depends run in declaration order
  • Test covers: dependency failure produces correct DependencyError chain
  • Test covers: sequential scripts run in order
  • Test covers: after-script runs on main-script failure
  • Test covers: after-script error does not change the returned exit code
  • Test covers: parallel mode dispatches all scripts
  • Test covers: parallel failure propagates as an error
  • Test covers: checksum env vars present in runner invocation
  • Test covers: checksum persisted only on success (not on failure)
  • All tests use package executor (internal), standard testing library, no third-party frameworks
  • go test ./internal/executor/... passes

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions