Skip to content

feat(component): support ssh in tmt tests - #422

Draft
Daniel McIlvaney (dmcilvaney) wants to merge 4 commits into
microsoft:damcilva/tmt-report-artifactsfrom
dmcilvaney:damcilva/add_ssh_to_tmt
Draft

Daniel McIlvaney (dmcilvaney) wants to merge 4 commits into
microsoft:damcilva/tmt-report-artifactsfrom
dmcilvaney:damcilva/add_ssh_to_tmt

Conversation

@dmcilvaney

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 22:42
@dmcilvaney Daniel McIlvaney (dmcilvaney) changed the title Damcilva/add ssh to tmt feat(component): support ssh in tmt tests Oct 29, 2026

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.

🟡 Changes recommended

The new TMT/SSH guidance lacks required rendered-content test assertions covering connection flags, host-key settings, and structured-report instructions.

1 open issue
What changed in this PR

This PR extends azldev component test to run TMT tests on existing SSH guests and adds structured results with retained logs and JUnit reports across provisioner modes.

Changes:

  • Adds SSH connection flags and validation, with optional candidate RPM installation for connect mode.
  • Retains per-run artifacts, reports native exit codes, and handles output-write failures.
  • Adds local and SSH end-to-end coverage, updates documentation, and keeps virtual coverage explicitly opt-in.
File Description
scenario/​tmt_virtual_e2e_test.go Checks KVM availability before setup; clarifies quarantine.
scenario/​tmt_local_e2e_test.go Covers local results, artifacts, and interruption handling.
scenario/​tmt_connect_e2e_test.go Covers SSH provisioning, host trust, and reporting.
scenario/​testdata/​tmt-root/​main.fmf Adds a root-level smoke plan.
scenario/​testdata/​tmt-root/​.fmf/​version Declares the root-plan fixture’s fmf tree.
scenario/​testdata/​tmt-local/​tests.fmf Defines local test-result cases.
scenario/​testdata/​tmt-local/​run.sh Exercises local reporting and cancellation scenarios.
scenario/​testdata/​tmt-local/​plans.fmf Defines reporting and lifecycle-failure plans.
scenario/​testdata/​tmt-local/​.fmf/​version Declares the local fixture’s fmf tree.
scenario/​testdata/​tmt-connect/​tests.fmf Defines SSH pass, fail, and error tests.
scenario/​testdata/​tmt-connect/​run.sh Exercises host trust and guest package installation.
scenario/​testdata/​tmt-connect/​plans.fmf Defines SSH test-selection plans.
scenario/​testdata/​tmt-connect/​helper.sh Checks remote helper transfer and elevated execution.
scenario/​testdata/​tmt-connect/​.fmf/​version Declares the SSH fixture’s fmf tree.
scenario/​internal/​containertest/​containers.go Supports named Docker networks.
scenario/​internal/​cmdtest/​cmdtest.go Passes network selections to container tests.
scenario/​docker/​Dockerfile.tmt-ssh Provides a disposable SSH guest image.
magefiles/​magescenario/​magescenario.go Selects all TMT end-to-end tests without enabling virtual coverage.
internal/​app/​azldev/​testresult.go Defines structured test-run results.
internal/​app/​azldev/​command.go Propagates JSON output-write failures.
internal/​app/​azldev/​command_test.go Tests failed and short JSON writes.
internal/​app/​azldev/​cmds/​component/​tmtrunner.go Manages retained artifacts, transcripts, and exit codes.
internal/​app/​azldev/​cmds/​component/​tmtrunner_internal_test.go Tests artifact collection and capture failures.
internal/​app/​azldev/​cmds/​component/​test.go Adds connect mode and integrates structured reporting.
internal/​app/​azldev/​cmds/​component/​test_internal_test.go Updates runner and command-argument assertions.
internal/​app/​azldev/​cmds/​component/​connect_internal_test.go Tests connection validation and environment preservation.
internal/​app/​azldev/​agentskill/​content/​build-component.md.tmpl Adds SSH testing and reporting guidance.
go.mod Makes the SSH cryptography dependency direct.
docs/​user/​reference/​cli/​azldev_component.md Updates the component-test command summary.
docs/​user/​reference/​cli/​azldev_component_test.md Documents connection flags and retained results.
docs/​user/​explanation/​tmt-tests.md Explains SSH workflows and artifact semantics.
docs/​developer/​how-to/​testing.md Documents TMT coverage and virtual-test opt-in.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 2, 2026 19:38

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.

🔵 Needs a closer look

CSV mode forwards child stdout into the report before the header and artifact rows, contaminating machine-readable output; child stdout should be redirected to stderr for CSV as well.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Prevent child stdout from contaminating CSV reports

internal/​app/​azldev/​cmds/​component/​tmtrunner.go:211

-O csv also requests machine-readable results, but this branch only protects JSON output. In CSV mode, any child stdout is forwarded to env.ReportFile() before RunFuncWithExtraArgs writes the CSV header and artifact rows, contaminating the report with runner/setup output. Redirect child stdout to stderr for CSV as well so downstream CSV consumers receive only the structured results.

1 resolved since last review

Review effort: Balanced

@dmcilvaney
Daniel McIlvaney (dmcilvaney) changed the base branch from main to damcilva/tmt-report-artifacts November 2, 2026 21:31
Copilot AI balanced review requested due to automatic review settings November 2, 2026 21:31

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.

🟡 Changes recommended

Privileged connect tasks can create root-owned, mode-0600 artifacts that subsequent unprivileged rsync collection cannot retrieve because the existing SSH permission repair is skipped.

1 open issue

Review effort: Balanced

Comment thread internal/tmt/component.go
Comment on lines +840 to +843
args = append(args, "provision", "--how", settings.Provision, "--become")
if settings.Provision == ProvisionConnect {
args = append(args, "--guest", settings.Connection.Guest, "--port", strconv.Itoa(settings.Connection.Port),
"--user", settings.Connection.User, "--key", settings.Connection.Key)
Add native connect provisioning with explicit SSH inputs, inherited host-key policy, optional candidate RPMs, and shared native reporting. Document guest-writable work directories and cover argument construction and validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Exercise native SSH provisioning against a separate disposable Azure Linux container, including host-key rejection, dependency and RPM installation, and native reports. Run alongside existing TMT end-to-end coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Assert rendered connection flags, host-key settings, and structured report guidance. Include the same TMT guidance in the no-lockfile skill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate SSH validation and key resolution after the TMT package extraction. Keep command descriptions outside the constructor and format migrated regression tests.

Validation: Go 1.26.0 with GOTOOLCHAIN=local; TESTING_DISABLE_NETWORK_TESTS=1 mage all check all passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants