Skip to content

feat (image-test): run LISA test suites locally via 'image test'#292

Draft
liunan-ms wants to merge 1 commit into
microsoft:mainfrom
liunan-ms:liunan/add_lisa
Draft

feat (image-test): run LISA test suites locally via 'image test'#292
liunan-ms wants to merge 1 commit into
microsoft:mainfrom
liunan-ms:liunan/add_lisa

Conversation

@liunan-ms

@liunan-ms liunan-ms commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Previously LISA-type test suites were rejected by azldev image test and only served as metadata for external orchestration. This adds a local runner that generates a LISA runbook from a suite's configured test cases, boots the image in a QEMU VM, and runs the tests.

Changes

  • Extend LisaConfig with a framework git source, test-cases, pip pre-install/extras, and extra-args; validate that the framework ref is a full commit SHA and that test-cases is non-empty.
  • Generate a qemu-platform runbook that inlines the image path and an ephemeral admin key, with keep_environment=no so VMs are torn down after the run.
  • Auto-generate and clean up an ephemeral admin SSH key pair per run.
  • Require the image to already be qcow2 (reject other formats) before booting.
  • Regenerate CLI docs, JSON schema, and scenario snapshots.

Testing

  • mage unit — pass
  • mage check all — pass (golangci-lint, editorconfig, staticcheck, licenses, ruff, pyright)
  • mage scenarioUpdate — snapshots regenerated

Usage in microsoft/azurelinux#18042

Previously LISA-type suites were rejected by 'azldev image test' and only
served as metadata for external orchestration. This adds a local runner
that generates a LISA runbook from a suite's configured test cases, boots
the image in a QEMU VM, and runs the tests.

- Extend LisaConfig with a framework git source, test-cases, pip
  pre-install/extras, and extra-args; validate that the framework ref is a
  full commit SHA and that test-cases is non-empty.
- Generate a qemu-platform runbook that inlines the image path and an
  ephemeral admin key, with keep_environment=no so VMs are torn down.
- Auto-generate and clean up an ephemeral admin SSH key pair per run.
- Require the image to be qcow2 (reject other formats) before booting.
- Regenerate CLI docs, JSON schema, and scenario snapshots.
Copilot AI review requested due to automatic review settings July 17, 2026 00:02

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.

Pull request overview

This PR enables running LISA-based image test suites locally via azldev image test, expanding the existing test-suite model (previously only pytest was runnable) to support generating a LISA runbook, booting the image via QEMU, and executing LISA against it.

Changes:

  • Extend test-suite configuration with an optional [lisa] subtable (LisaConfig) including framework git source + test cases and related options, plus validation of the framework ref and presence of test cases.
  • Add a local LISA runner that clones the framework repo at a pinned commit, creates/reuses a per-suite venv, generates a qemu-platform runbook, generates an ephemeral SSH keypair, and invokes LISA.
  • Regenerate schema, CLI docs, and scenario snapshots to reflect the new configuration surface.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
schemas/azldev.schema.json Generated JSON schema updates to include GitSourceConfig and LisaConfig.
scenario/snapshots/TestSnapshotsContainer_config_generate-schema_stdout_1.snap Snapshot refresh for schema generation output (container mode).
scenario/snapshots/TestSnapshots_config_generate-schema_stdout_1.snap Snapshot refresh for schema generation output (non-container mode).
internal/projectconfig/testsuite.go Adds LisaConfig, GitSourceConfig, and new validation logic for LISA suites.
internal/projectconfig/testsuite_test.go Unit tests for new LISA validation behavior.
internal/projectconfig/loader_test.go Loader test updated to parse and validate a LISA suite config.
internal/app/azldev/cmds/image/test.go Routes lisa suites to the new local runner and updates help text.
internal/app/azldev/cmds/image/lisarunner.go New implementation: clone framework, venv setup, runbook generation, qcow2 enforcement, and LISA invocation.
internal/app/azldev/cmds/image/lisarunbook.go New runbook YAML model + generator for QEMU platform.
internal/app/azldev/cmds/image/lisarunbook_internal_test.go Unit tests for runbook YAML generation.
docs/user/reference/cli/azldev_image_test.md Regenerated CLI docs describing LISA suite behavior.

Comment on lines +106 to +108
// TestCases lists the LISA test case names to run. They are combined (joined with '|')
// into the criteria of a runbook that azldev generates and runs.
TestCases []string `toml:"test-cases,omitempty" json:"testCases,omitempty" jsonschema:"title=Test cases,description=LISA test case names to run; combined into a generated runbook's criteria"`
Comment on lines +95 to +102
// Generate a runbook from the configured test cases and write it into the framework
// tree so its relative includes resolve.
runbookPath, err := writeGeneratedRunbook(
env, frameworkDir, suiteConfig.Name, lisaConfig.TestCases, options.ImagePath, adminKeyPath,
)
if err != nil {
return err
}
Comment on lines +238 to +239
shortSHA := source.Ref[:shortSHALength]
repoDir := filepath.Join(baseDir, category, shortSHA)
Comment on lines +265 to +270
} else {
slog.Info("Reusing existing git repo",
slog.String("path", repoDir),
slog.String("ref", source.Ref),
)
}
@liunan-ms liunan-ms changed the title feat: run LISA test suites locally via 'image test' feat (image-test): run LISA test suites locally via 'image test' Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "feat (image-test): run LISA test suites locally via 'image test'". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

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