Skip to content

refactor(lisa): extract image test helper package - #417

Merged
Nan Liu (liunan-ms) merged 1 commit into
microsoft:mainfrom
reubeno:refactor/extract-lisa-helper
Oct 29, 2026
Merged

Nan Liu (liunan-ms) merged 1 commit into
microsoft:mainfrom
reubeno:refactor/extract-lisa-helper

Conversation

@reubeno

Copy link
Copy Markdown
Member

Summary

Extract the existing LISA integration into internal/lisa: definition/source parsing, criteria, runbook generation, framework/venv setup, invocation, and helper tests. The image command retains selection and dispatch and calls lisa.RunTestDefinition directly, without forwarding wrappers.

Move the existing shared image-format inference and format ordering from the boot command into utils/imageformat, with its tests. Boot and LISA use that neutral helper rather than making LISA depend on command-package code.

This is the third extraction in the planned build/test refactor, following #415 and #416. It is independent of the parallel TMT extraction. Existing qcow2-only behavior, arguments, diagnostics, work paths, cached checkouts, venv reuse, key handling, runbook contents, and cleanup remain unchanged. No new framework capabilities, artifact policies, runtime isolation, or result semantics are introduced.

Validation

  • mage all — passed, including code generation/build, unit tests, default quality checks, scenarios, and CLI/schema generation.
  • git diff --check upstream/main...HEAD — passed.
  • Mechanically compared moved function/test bodies against upstream after package/type renames. All original helper and format-inference tests are retained.
  • Added an in-memory command invocation test covering image name/path, local framework override, native arguments, generated criteria, and runbook cleanup.
  • No schema or snapshot changes; discarded generated CLI-doc drift limited to the local 0.0.0-devel version label.

mage fix all completed Go formatting/linting with zero issues, then stopped at optional Python autofixing because ruff is unavailable. No Python source changed; the required mage all pipeline passed independently. Native E2E tests were not run.

Move the existing LISA definition parsing, criteria, runbook, setup, invocation and tests into internal/lisa. Image commands call the helper directly; shared image-format inference and its tests move to a neutral utility without changing format priority or diagnostics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 20:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the LISA execution and shared image-format refactor.

No open issues 🎉

What changed in this PR

Continues the build/test refactor from #415 and #416 by extracting LISA execution from the image command package into internal/lisa, while preserving existing behavior.

Changes:

  • Moves LISA parsing, runbook generation, setup, invocation, and helper tests into a dedicated package.
  • Extracts shared image-format inference and ordering into internal/utils/imageformat.
  • Updates command dispatch and adds in-memory coverage for LISA option forwarding and runbook cleanup.
File Description
internal/​utils/​imageformat/​imageformat.go Houses shared format constants, ordering, and inference.
internal/​utils/​imageformat/​imageformat_test.go Retains extracted format-helper tests.
internal/​lisa/​runner.go Extracts LISA execution with dedicated options.
internal/​lisa/​runner_internal_test.go Retains argument, format, and checkout-resolution tests.
internal/​lisa/​runbook.go Moves runbook generation into LISA ownership.
internal/​lisa/​runbook_internal_test.go Moves runbook tests alongside implementation.
internal/​lisa/​criteria.go Moves criteria parsing into LISA ownership.
internal/​lisa/​criteria_internal_test.go Moves criteria tests alongside implementation.
internal/​app/​azldev/​cmds/​image/​test.go Calls LISA and shared format helpers directly.
internal/​app/​azldev/​cmds/​image/​test_test.go Adds LISA dispatch and cleanup coverage.
internal/​app/​azldev/​cmds/​image/​test_internal_test.go Relocates LISA-specific tests to the new package.
internal/​app/​azldev/​cmds/​image/​boot.go Uses shared helpers while retaining boot-specific validation.
internal/​app/​azldev/​cmds/​image/​boot_test.go Relocates shared format tests to the utility package.

Review effort: Balanced

@reubeno
reuben olinsky (reubeno) marked this pull request as ready for review October 29, 2026 20:25
@liunan-ms
Nan Liu (liunan-ms) merged commit 6031a09 into microsoft:main Oct 29, 2026
22 checks passed
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.

4 participants