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
20 changes: 20 additions & 0 deletions docs/user/reference/config/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ A component definition tells azldev where to find the spec file, how to customiz
| Render config | `render` | [RenderConfig](#render-configuration) | No | Options controlling spec rendering behavior |
| Source files | `source-files` | array of [SourceFileReference](#source-file-references) | No | Additional source files to download for this component |
| Package overrides | `packages` | map of string → [PackageConfig](package-groups.md#package-config) | No | Exact per-package configuration overrides; highest priority in the resolution order |
| Tests | `tests` | [ComponentTests](#component-tests) | No | Test references that apply to this component (see [Tests and Test Groups](tests.md)) |

### Bare Components

Expand Down Expand Up @@ -300,6 +301,24 @@ rpm-channel = "rpm-devel"
rpm-channel = "none"
```

## Component Tests

The `[components.<name>.tests]` subtable lists test or test-group
references that apply to the component. Each entry is a [TestRef](tests.md#test-reference)
with exactly one of `name` or `group`.

| Field | TOML Key | Type | Required | Description |
|-------|----------|------|----------|-------------|
| Tests | `tests` | array of [TestRef](tests.md#test-reference) | No | References to `[tests.<name>]` entries or `[test-groups.<name>]` entries |

```toml
[components.kernel.tests]
tests = [
{ group = "kernel-bvt" },
{ name = "kdump-smoke" },
]
```

## Source File References

The `[[components.<name>.source-files]]` array defines additional source files that azldev should download before building. These are files not available in the dist-git repository or lookaside cache — typically binaries, pre-built artifacts, or files from custom hosting.
Expand Down Expand Up @@ -461,5 +480,6 @@ lines = ["cp -vf %{shimdirx64}/$(basename %{shimefix64}) %{shimefix64} ||:"]
- [Distros](distros.md) — distro definitions and `default-component-config` inheritance
- [Component Groups](component-groups.md) — grouping components with shared defaults
- [Package Groups](package-groups.md) — project-level package groups and full resolution order
- [Tests and Test Groups](tests.md) — definitions referenced by `[components.<name>.tests]`
- [Configuration System](../../explanation/config-system.md) — inheritance and merge behavior
- [JSON Schema](../../../../schemas/azldev.schema.json) — machine-readable schema
2 changes: 2 additions & 0 deletions docs/user/reference/config/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ All config files share the same schema — there is no distinction between a "ro
| `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) |
| `default-package-config` | object | Project-wide default applied to all binary packages | [Package Groups — Resolution Order](package-groups.md#resolution-order) |
| `package-groups` | map of objects | Named groups of binary packages with shared config | [Package Groups](package-groups.md) |
Expand Down
4 changes: 3 additions & 1 deletion docs/user/reference/config/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ 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.
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.

| 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 @@ -118,4 +119,5 @@ channels = ["registry-prod", "registry-staging"]

- [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
89 changes: 89 additions & 0 deletions docs/user/reference/config/tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Tests and Test Groups

The `[tests]` and `[test-groups]` sections declare framework-agnostic test
metadata that components and images can target by name. Each test entry
binds a single test (a pytest run, a LISA case, or a TMT plan)
to a named identifier; each group entry bundles tests (and
named references) under one name so callers can reference a curated set
without enumerating every member.

## Test Definition

Each entry under `[tests.<name>]` describes one configuration of one
runner. Framework-specific options live in a typed subtable
(`pytest`, `lisa`, `tmt`) whose contents are passed through
to the runner; their internal schemas are intentionally not validated
by azldev so frameworks can evolve independently.
Comment thread
bhagyapathak marked this conversation as resolved.
Comment thread
bhagyapathak marked this conversation as resolved.

| Field | TOML Key | Type | Required | Description |
|-------|----------|------|----------|-------------|
| Type | `type` | string | Yes | Test framework: `pytest`, `lisa`, or `tmt` |
| Description | `description` | string | No | Human-readable description |
| Kind | `kind` | string | No | Test kind hint: `functional` or `performance` |
| Long running | `long-running` | boolean | No | Hints that this test may run for hours |
| Required capabilities | `required-capabilities` | string array | No | Capability tokens the image must declare for this test to be applicable |
| Lisa | `lisa` | table | No | LISA-specific configuration (opaque to azldev) |
| Tmt | `tmt` | table | No | TMT-specific configuration (opaque to azldev) |
| Pytest | `pytest` | table | No | pytest-specific configuration (opaque to azldev) |

## Test Group

Each entry under `[test-groups.<name>]` names an ordered list of test
references that callers can target as a single unit.

| Field | TOML Key | Type | Required | Description |
|-------|----------|------|----------|-------------|
| Description | `description` | string | No | Human-readable description |
| Tests | `tests` | array of [TestRef](#test-reference) | No | Ordered members of the group (name refs only) |

## Test Reference

`TestRef` is an inline table with exactly one of `name` or `group`:

| Field | TOML Key | Type | Description |
|-------|----------|------|-------------|
| Name | `name` | string | References a `[tests.<name>]` entry |
| Group | `group` | string | References a `[test-groups.<name>]` entry |

## Referencing from Components and Images

Components and images both expose a `tests` subtable that holds a list
of `TestRef`s:

```toml
[components.kernel.tests]
tests = [{ group = "kernel-bvt" }, { name = "kdump-smoke" }]

[images.vm-base.tests]
tests = [{ group = "bvt" }]
```

## Example

```toml
[tests.bvt-ssh]
type = "pytest"
description = "Basic SSH boot verification"
kind = "functional"
required-capabilities = ["ssh"]
pytest = { working-dir = "tests/bvt", test-paths = ["test_ssh.py"] }

[tests.kdump-smoke]
type = "lisa"
description = "Smoke test for kdump"
lisa = { case = "kdump.smoke" }

[test-groups.bvt]
description = "Build verification tests"
tests = [
{ name = "bvt-ssh" },
{ name = "kdump-smoke" },
]
```

## 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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ require (
github.com/muesli/termenv v0.16.0
github.com/nxadm/tail v1.4.11
github.com/opencontainers/selinux v1.15.1
github.com/pb33f/ordered-map/v2 v2.3.1
github.com/pelletier/go-toml/v2 v2.4.2
github.com/pmezard/go-difflib v1.0.0
github.com/samber/lo v1.53.0
Expand Down Expand Up @@ -131,7 +132,6 @@ require (
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pb33f/ordered-map/v2 v2.3.1 // indirect
github.com/pjbgf/sha1cd v0.6.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
Expand Down
2 changes: 1 addition & 1 deletion internal/app/azldev/cmds/image/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type ImageListResult struct {

// Tests holds the test configuration for this image, matching the original config
// structure.
Tests projectconfig.ImageTestsConfig `json:"tests" table:"-"`
Tests *projectconfig.ImageTestsConfig `json:"tests,omitempty" table:"-"`
Comment thread
bhagyapathak marked this conversation as resolved.

// TestsSummary is a comma-separated summary of test suite names for table display.
TestsSummary string `json:"-" table:"Tests"`
Expand Down
12 changes: 7 additions & 5 deletions internal/app/azldev/cmds/image/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestListImages_WithCapabilitiesAndTests(t *testing.T) {
MachineBootable: lo.ToPtr(true),
Systemd: lo.ToPtr(true),
},
Tests: projectconfig.ImageTestsConfig{
Tests: &projectconfig.ImageTestsConfig{
TestSuites: []projectconfig.TestSuiteRef{
{Name: "smoke"},
{Name: "integration"},
Expand All @@ -105,7 +105,7 @@ func TestListImages_WithCapabilitiesAndTests(t *testing.T) {
Capabilities: projectconfig.ImageCapabilities{
Container: lo.ToPtr(true),
},
Tests: projectconfig.ImageTestsConfig{
Tests: &projectconfig.ImageTestsConfig{
TestSuites: []projectconfig.TestSuiteRef{
{Name: "smoke"},
},
Expand All @@ -131,9 +131,10 @@ func TestListImages_WithCapabilitiesAndTests(t *testing.T) {
assert.Equal(t, lo.ToPtr(true), results[0].Capabilities.Container)
assert.Nil(t, results[0].Capabilities.MachineBootable)
assert.Equal(t, "container", results[0].CapabilitiesSummary)
require.NotNil(t, results[0].Tests)
assert.Equal(t, projectconfig.ImageTestsConfig{
TestSuites: []projectconfig.TestSuiteRef{{Name: "smoke"}},
}, results[0].Tests)
}, *results[0].Tests)
assert.Equal(t, "smoke", results[0].TestsSummary)
assert.Equal(t, projectconfig.ImagePublishConfig{
Channels: []string{"registry-prod"},
Expand All @@ -144,7 +145,7 @@ func TestListImages_WithCapabilitiesAndTests(t *testing.T) {
assert.Nil(t, results[1].Capabilities.MachineBootable)
assert.Nil(t, results[1].Capabilities.Container)
assert.Empty(t, results[1].CapabilitiesSummary)
assert.Empty(t, results[1].Tests.TestSuites)
assert.Nil(t, results[1].Tests)
assert.Empty(t, results[1].TestsSummary)
assert.Empty(t, results[1].Publish.Channels)
assert.Empty(t, results[1].PublishSummary)
Expand All @@ -154,9 +155,10 @@ func TestListImages_WithCapabilitiesAndTests(t *testing.T) {
assert.Equal(t, lo.ToPtr(true), results[2].Capabilities.Systemd)
assert.Nil(t, results[2].Capabilities.Container)
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"}},
}, results[2].Tests)
}, *results[2].Tests)
assert.Equal(t, "smoke, integration", results[2].TestsSummary)
assert.Equal(t, projectconfig.ImagePublishConfig{
Channels: []string{"registry-prod", "registry-staging"},
Expand Down
9 changes: 9 additions & 0 deletions internal/projectconfig/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,14 @@ type ComponentConfig struct {
// all packages produced by this component. Overridden by package-group and per-package settings
// for binary and debuginfo channels.
Publish ComponentPublishConfig `toml:"publish,omitempty" json:"publish,omitempty" table:"-" jsonschema:"title=Publish settings,description=Component-level publish channel settings" fingerprint:"-"`

// Tests holds the new-shape per-component tests block:
//
// tests.tests = [{ name = "..." }, { group = "..." }]
//
// References must resolve to entries in the project-level [tests] or
// [test-groups] maps; resolution is the responsibility of the test layer.
Tests *ComponentTestsConfig `toml:"tests,omitempty" json:"tests,omitempty" table:"-" jsonschema:"title=Tests,description=Per-component test or test-group references" fingerprint:"-"`
}

// AllowedSourceFilesHashTypes defines the set of hash types that are supported
Expand Down Expand Up @@ -408,6 +416,7 @@ func (c *ComponentConfig) WithAbsolutePaths(referenceDir string) *ComponentConfi
// here so inherited patterns can be interpreted relative to the concrete component
// config file.
OverlayFiles: slices.Clone(c.OverlayFiles),
Tests: deep.MustCopy(c.Tests),
}

// Fix up paths.
Expand Down
Loading
Loading