Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions docs/user/reference/cli/azldev_image_test.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/user/reference/config/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ All config files share the same schema — there is no distinction between a "ro
| `components` | map of objects | Component (package) definitions | [Components](components.md) |
| `component-groups` | map of objects | Named groups of components with shared defaults | [Component Groups](component-groups.md) |
| `images` | map of objects | Image definitions (VMs, containers) | [Images](images.md) |
| `test-suites` | map of objects | Named test suite definitions referenced by images | [Test Suites](test-suites.md) |
| `tests` | map of objects | Named test definitions (new-shape, parse-only) | [Tests and Test Groups](tests.md) |
| `test-groups` | map of objects | Named bundles of test references (new-shape, parse-only) | [Tests and Test Groups](tests.md) |
| `tools` | object | Configuration for external tools used by azldev | [Tools](tools.md) |
Expand Down
12 changes: 5 additions & 7 deletions docs/user/reference/config/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ The `capabilities` subtable describes what the image supports. All fields are op

## Image Tests

The `tests` subtable links an image to one or more test suites defined in the top-level [`[test-suites]`](test-suites.md) section, and/or to entries from the new-shape [`[tests]` / `[test-groups]`](tests.md) sections.
The `tests` subtable links an image to one or more tests or test groups defined in the top-level [`[tests]` / `[test-groups]`](tests.md) sections.

| Field | TOML Key | Type | Required | Description |
|-------|----------|------|----------|-------------|
| Test Suites | `test-suites` | array of inline tables | No | List of test suite references. Each entry must have a `name` field matching a key in `[test-suites]`. |
| Tests | `tests` | array of [TestRef](tests.md#test-reference) | No | References to `[tests.<name>]` entries or `[test-groups.<name>]` entries (parse-only; see [Tests and Test Groups](tests.md)). |

## Image Publish
Expand Down Expand Up @@ -90,7 +89,7 @@ description = "Azure-optimized VM image"
definition = { type = "kiwi", path = "vm-azure/vm-azure.kiwi", profile = "azure" }
```

### Image with test suite references
### Image with test references

```toml
[images.vm-base]
Expand All @@ -102,9 +101,9 @@ machine-bootable = true
systemd = true

[images.vm-base.tests]
test-suites = [
{ name = "smoke" },
{ name = "integration" },
tests = [
{ name = "static-image-checks" },
{ group = "vm-base-functional" },
]
```

Expand All @@ -122,6 +121,5 @@ channels = ["registry-prod", "registry-staging"]
## Related Resources

- [Config File Structure](config-file.md) — top-level config file layout
- [Test Suites](test-suites.md) — test suite definitions
- [Tests and Test Groups](tests.md) — new-shape test/group definitions referenced by `[images.<name>.tests]`
- [Tools](tools.md) — Image Customizer tool configuration
171 changes: 0 additions & 171 deletions docs/user/reference/config/test-suites.md

This file was deleted.

3 changes: 1 addition & 2 deletions docs/user/reference/config/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ can evolve independently.
The `[tests.<name>.lisa]` subtable is mostly opaque to azldev, but it
recognizes a few keys used to select LISA test cases and, optionally, to
run the test locally via `azldev image test` (booting the image in a QEMU
VM, same as legacy `[test-suites]` LISA suites).
VM).

| Field | TOML Key | Type | Description |
|-------|----------|------|-------------|
Expand Down Expand Up @@ -138,7 +138,6 @@ tests = [

## Related Resources

- [Test Suites](test-suites.md) - legacy test suite definitions
- [Components](components.md#component-tests) — per-component `tests` field
- [Images](images.md#image-tests) — per-image `tests` field
- [Config File Structure](config-file.md) — top-level config layout
4 changes: 2 additions & 2 deletions internal/app/azldev/agentskill/content/image.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ definition = { type = "kiwi", path = "container-base/container-base.kiwi", profi
systemd = false

[images.container-base.tests]
test-suites = [{ name = "smoke" }]
tests = [{ name = "smoke" }]
```

- `definition.type` is `kiwi` (the only type today); `path` points at the `.kiwi` file;
`profile` selects a kiwi profile (optional).
- `capabilities` are tri-state flags describing the image — `machine-bootable`,
`container`, `systemd`, `runtime-package-management`. Set only the ones that apply.
- `tests.test-suites` lists the test suites `azldev image test` runs.
- `tests.tests` lists the tests or test groups `azldev image test` runs.
- `publish.channels` lists the channels the image publishes to.

## The kiwi definition
Expand Down
39 changes: 3 additions & 36 deletions internal/app/azldev/cmds/image/lisarunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,6 @@ const (
lisaGeneratedRunbookPrefix = "azldev-generated-"
)

// RunLisaSuite runs a LISA-based test suite by cloning the framework repo, setting up a
// venv, generating a runbook from the configured test cases, and invoking LISA.
func RunLisaSuite(
env *azldev.Env, suiteConfig *projectconfig.TestSuiteConfig,
imageConfig *projectconfig.ImageConfig, options *ImageTestOptions,
) error {
lisaConfig := suiteConfig.Lisa
if lisaConfig == nil {
return fmt.Errorf(
"test suite %#q of type %#q cannot be run locally: it has no [test-suites.%s.lisa] "+
"subtable; add one with 'framework' (git-url, ref), 'test-cases', and optional "+
"'extra-args' to enable local execution",
suiteConfig.Name, projectconfig.TestTypeLisa, suiteConfig.Name,
)
}

slog.Info("Running LISA test suite",
slog.String("name", suiteConfig.Name),
slog.String("framework-ref", lisaConfig.Framework.Ref),
slog.Int("test-cases", len(lisaConfig.TestCases)),
slog.String("image-path", options.ImagePath),
)

criteria := []lisaCriteria{{Name: strings.Join(lisaConfig.TestCases, "|")}}

return runLisaLocally(
env, suiteConfig.Name, &lisaConfig.Framework, criteria,
lisaConfig.PipPreInstall, lisaConfig.PipExtras, lisaConfig.ExtraArgs,
imageConfig, options,
)
}

// RunLisaTestDefinition runs a new-style [tests.X] LISA test definition locally, generating
// a runbook from the test's configured criteria and invoking LISA. It requires either
// options.LisaDir (an already-cloned LISA checkout) or the test's [tests.X.lisa] subtable
Expand Down Expand Up @@ -136,10 +104,9 @@ func RunLisaTestDefinition(
}

// runLisaLocally sets up the LISA framework and venv, generates a runbook from the given
// criteria, and invokes LISA against the given image. It is shared by RunLisaSuite (legacy
// [test-suites] suites) and RunLisaTestDefinition (new-style [tests] definitions). If
// options.LisaDir is set, that checkout is used directly instead of cloning framework; in
// that case framework may be nil.
// criteria, and invokes LISA against the given image. It backs RunLisaTestDefinition
// (new-style [tests] definitions). If options.LisaDir is set, that checkout is used directly
// instead of cloning framework; in that case framework may be nil.
func runLisaLocally(
env *azldev.Env, name string, framework *projectconfig.GitSourceConfig, criteria []lisaCriteria,
pipPreInstall, pipExtras, extraArgs []string,
Expand Down
8 changes: 4 additions & 4 deletions internal/app/azldev/cmds/image/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestListImages_WithCapabilitiesAndTests(t *testing.T) {
Systemd: lo.ToPtr(true),
},
Tests: &projectconfig.ImageTestsConfig{
TestSuites: []projectconfig.TestSuiteRef{
Tests: []projectconfig.TestRef{
{Name: "smoke"},
{Name: "integration"},
},
Expand All @@ -106,7 +106,7 @@ func TestListImages_WithCapabilitiesAndTests(t *testing.T) {
Container: lo.ToPtr(true),
},
Tests: &projectconfig.ImageTestsConfig{
TestSuites: []projectconfig.TestSuiteRef{
Tests: []projectconfig.TestRef{
{Name: "smoke"},
},
},
Expand All @@ -133,7 +133,7 @@ func TestListImages_WithCapabilitiesAndTests(t *testing.T) {
assert.Equal(t, "container", results[0].CapabilitiesSummary)
require.NotNil(t, results[0].Tests)
assert.Equal(t, projectconfig.ImageTestsConfig{
TestSuites: []projectconfig.TestSuiteRef{{Name: "smoke"}},
Tests: []projectconfig.TestRef{{Name: "smoke"}},
}, *results[0].Tests)
assert.Equal(t, "smoke", results[0].TestsSummary)
assert.Equal(t, projectconfig.ImagePublishConfig{
Expand All @@ -157,7 +157,7 @@ func TestListImages_WithCapabilitiesAndTests(t *testing.T) {
assert.Equal(t, "machine-bootable, systemd", results[2].CapabilitiesSummary)
require.NotNil(t, results[2].Tests)
assert.Equal(t, projectconfig.ImageTestsConfig{
TestSuites: []projectconfig.TestSuiteRef{{Name: "smoke"}, {Name: "integration"}},
Tests: []projectconfig.TestRef{{Name: "smoke"}, {Name: "integration"}},
}, *results[2].Tests)
assert.Equal(t, "smoke, integration", results[2].TestsSummary)
assert.Equal(t, projectconfig.ImagePublishConfig{
Expand Down
Loading
Loading