Skip to content

test: implement unit tests for core lifecycle (12 stubs)#359

Open
Koan-Bot wants to merge 1 commit intoTest-More:2.0from
Koan-Bot:koan.atoomic/fix-issue-326
Open

test: implement unit tests for core lifecycle (12 stubs)#359
Koan-Bot wants to merge 1 commit intoTest-More:2.0from
Koan-Bot:koan.atoomic/fix-issue-326

Conversation

@Koan-Bot
Copy link
Copy Markdown
Contributor

@Koan-Bot Koan-Bot commented Mar 30, 2026

Summary

Implements all 12 stub test files (previously skip_all "write me") for the Test2::Harness core lifecycle modules — the instance orchestrator, run/job management, runner execution, and test settings.

Fixes #326

Changes

  • Test2::Harness::Client — abstract interface, send_and_get success/failure paths, ping delegation
  • Test2::Harness::Instance — required attribute validation, api_ping/api_pid/api_log_file, handle_request success and error paths, parse_request_args (scalar/array/hash), terminate first-reason-wins semantics
  • Test2::Harness::Instance::Message — attribute accessors, TO_JSON includes class field
  • Test2::Harness::Instance::Request — required attribute validation, inheritance from Message, TO_JSON
  • Test2::Harness::Instance::Response — required attribute validation (including exists check for undef response), success() boolean
  • Test2::Harness::Run — required attrs, aggregator_use_io alternative, set_ipc/ipc round-trip, TO_JSON excludes internal fields, data_no_jobs
  • Test2::Harness::Run::Job — auto-generated job_id, try() counts results, resource_id(), TO_JSON, process_info excludes private fields
  • Test2::Harness::Runner — required attrs, ready()/stages()/stage_sets(), terminate first-reason-wins, kill
  • Test2::Harness::Runner::Preloadingblacklist add/query, terminate first-reason-wins, preload_retry_delay default
  • Test2::Harness::Runner::Preloading::Stage — attribute accessors, terminate overwrites (no first-reason-wins — matches implementation)
  • Test2::Harness::TestFile — file validation, HARNESS directive scanning (NO-FORK, DURATION, CATEGORY, CONFLICTS, TIMEOUT-EVENT, META), check_feature defaults, set_duration/set_category
  • Test2::Harness::TestSettings — defaults, includes with lib/blib/tlib flags, merge (later wins, dedup arrays, merge hashes), propagate_false for fork/preload, set_env_vars, load_import UUID/MemUsage plugins

Test plan

  • All 12 test files run cleanly with perl -Ilib <file>: no failures
  • Tests cover observable behavior (return values, exceptions, attribute state) without inspecting source code
  • Mock collaborators used for Instance tests to avoid real IPC/forking
  • Windows-specific tests skipped on non-Windows via IS_WIN32

Generated by Kōan /fix


Quality Report

Changes: 1364 files changed, 103424 insertions(+), 24661 deletions(-)

Code scan: 224 issue(s) found

  • .gitignore:40 — TODO comment
  • README:607 — TODO comment
  • README:611 — TODO comment
  • README:615 — TODO comment
  • README.md:565 — TODO comment
  • README.md:569 — TODO comment
  • README.md:573 — TODO comment
  • demo/tiny/tiny.t:4 — XXX marker
  • deplib/App/Yath/Option.pm:21 — FIXME comment
  • deplib/App/Yath/Options.pm:22 — FIXME comment

Tests: failed (FAILED)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Replaces all 12 stub tests (skip_all "write me") with real unit tests
covering the instance orchestrator, run/job management, runner lifecycle,
and test configuration modules.

Modules tested:
- Test2::Harness::Client (abstract base, send_and_get, error path)
- Test2::Harness::Instance (required attrs, api_ping/pid/log_file,
  handle_request success/error, parse_request_args, terminate first-reason-wins)
- Test2::Harness::Instance::Message (attributes, TO_JSON with class field)
- Test2::Harness::Instance::Request (required attrs, inheritance, TO_JSON)
- Test2::Harness::Instance::Response (required attrs, undef response, success())
- Test2::Harness::Run (required attrs, aggregator_use_io alt, set_ipc/ipc,
  TO_JSON excludes internal fields, data_no_jobs)
- Test2::Harness::Run::Job (auto job_id, try(), resource_id(), TO_JSON, process_info)
- Test2::Harness::Runner (required attrs, ready(), stages(), terminate first-reason-wins)
- Test2::Harness::Runner::Preloading (blacklist, terminate, preload_retry_delay)
- Test2::Harness::Runner::Preloading::Stage (attributes, terminate overwrites)
- Test2::Harness::TestFile (file validation, HARNESS directives, check_feature/duration/category)
- Test2::Harness::TestSettings (defaults, includes, merge, propagate_false, load_import)

Fixes Test-More#326

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@atoomic atoomic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@atoomic atoomic marked this pull request as ready for review March 31, 2026 01:22
@atoomic
Copy link
Copy Markdown
Collaborator

atoomic commented Mar 31, 2026

@exodist I let you validate before merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants