Skip to content

Implement unit tests for Test2::Harness core lifecycle (12 files) #326

@Koan-Bot

Description

@Koan-Bot

Context

The t/unit/Test2/Harness/ directory contains 12 test stubs for the core harness lifecycle — the instance orchestrator, run management, runner execution, and test settings. These are the heart of the 2.0 multi-process architecture.

Modules to test

Harness entry:

  • t/unit/Test2/Harness.tTest2::Harness

Instance (orchestrator):

  • t/unit/Test2/Harness/Instance.tTest2::Harness::Instance
  • t/unit/Test2/Harness/Instance/Message.t, Instance/Request.t, Instance/Response.t

Run & Job:

  • t/unit/Test2/Harness/Run.tTest2::Harness::Run
  • t/unit/Test2/Harness/Run/Job.tTest2::Harness::Run::Job

Runner:

  • t/unit/Test2/Harness/Runner.tTest2::Harness::Runner
  • t/unit/Test2/Harness/Runner/Preloading.t, Runner/Preloading/Stage.t

Test configuration:

  • t/unit/Test2/Harness/TestFile.tTest2::Harness::TestFile
  • t/unit/Test2/Harness/TestSettings.tTest2::Harness::TestSettings

Suggested test scenarios

Instance (orchestrator)

  • run(cb) — callback execution, error handling
  • stop() — graceful shutdown
  • handle_request(request) — request routing and response
  • terminate(reason) — termination with reason tracking (first-reason-wins semantics)
  • api_abort() / api_kill() — cascading abort/kill to scheduler + runner

Run & Job

  • Run: set_ipc() / ipc(), run_id generation, abort_on_bail attribute (default true), halt state transitions
  • Job: job data construction, environment setup, test file association

Runner

  • ready() — readiness check
  • start() / stop() / abort() / reload() — lifecycle methods
  • job_launch_data() — job execution data preparation
  • skip_job() — skip logic
  • launch_job() — job forking and execution
  • is_daemon attribute behavior

Runner::Preloading

  • Stage management, module preloading, stage-based test routing

TestFile & TestSettings

  • TestFile: test file metadata extraction, category/duration detection
  • TestSettings: settings composition, per-test overrides

Notes

These are high-value tests — the Instance/Runner/Scheduler triad is the core of yath 2.0's multi-process architecture. Mock the IPC layer (use simple in-process message passing) to test orchestration logic without actual forking.

The terminate() method's first-reason-wins semantics is critical — test concurrent termination attempts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.0TestUnit tests cars

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions