Skip to content

refactor(tmt): extract component test helper package - #418

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

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

Conversation

@reubeno

Copy link
Copy Markdown
Member

Summary

Extract the existing component TMT integration into internal/tmt: options, component/test resolution, configuration decoding, preflight, source preparation, venv setup, plan/hardware handling, candidate RPM insertion, native invocation, plugin, and implementation tests.

The component command retains registration/flags and calls tmt.RunComponentTests directly. Its four existing command-level cases remain at the command boundary; there are no forwarding wrappers or compatibility aliases.

Move the unchanged requirements file to internal/tmt/requirements.txt and update Dependabot, the existing virtual E2E consumer, and developer documentation to follow it. Pins remain tmt==1.79.0 and testcloud==0.12.0; the embedded testcloud plugin is byte-identical.

This is the fourth extraction in the planned build/test refactor, following #415 and #416. It is independent of the parallel LISA extraction. Existing VM/host modes, selection/failure policy, source/from-spec behavior, native plan steps, paths, diagnostics, guest bootstrap, and permission workarounds are preserved. Runtime fixes, shared execution contracts, new artifact policies, and new strategies remain separate work.

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 all 39 original implementation/command functions and 41 test/helper functions after package/type/export renames; original coverage is retained.
  • Verified the requirements file and complete embedded testcloud plugin are byte-identical to upstream.
  • 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 plugin was moved unchanged and the required mage all pipeline passed independently. Native E2E tests were not run; the existing TMT E2E quarantine remains intact.

Move the existing component TMT options, configuration and source resolution, preflight, setup, native invocation, plugin and tests into internal/tmt. Keep command wiring and command-level tests in component, and relocate the unchanged runtime constraints together with their Dependabot and E2E consumers.

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

The TMT runner extraction has no active review issues.

No open issues 🎉

What changed in this PR

Extracts component TMT execution into internal/tmt, continuing the build/test refactor after the image-builder and pytest extractions. The command retains CLI registration and flags while calling the extracted runner directly, preserving existing behavior.

Changes:

  • Moves TMT options, validation, environment setup, execution, and the unchanged testcloud plugin into the helper package.
  • Relocates implementation tests while retaining four command-level tests at the CLI boundary.
  • Moves dependency pins unchanged and updates Dependabot, the virtual E2E consumer, and developer documentation.
File Description
scenario/​tmt_virtual_e2e_test.go Uses the relocated TMT requirements file.
internal/​tmt/​requirements.txt Holds the unchanged TMT and testcloud pins.
internal/​tmt/​component.go Owns the extracted component TMT runner and supporting logic.
internal/​tmt/​component_internal_test.go Relocates implementation tests into the TMT package.
internal/​app/​azldev/​cmds/​component/​test.go Retains CLI wiring and delegates execution directly to TMT.
internal/​app/​azldev/​cmds/​component/​test_test.go Retains command registration and validation coverage.
docs/​developer/​how-to/​testing.md Updates the dependency path and removes stale version wording.
.github/​dependabot.yml Tracks TMT dependencies at their new location.

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 61b15af 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