Repository navigation
feat(config): add tmt.dist-git.enabled-components - #451
Open
bhagyapathak wants to merge 1 commit into
Open
bhagyapathak wants to merge 1 commit into
bhagyapathak wants to merge 1 commit into
Conversation
Add a top-level [tmt.dist-git] section whose enabled-components list names the components with dist-git TMT tests enabled. Consumers such as ControlTower can read it from 'azldev config dump' (tmt.distGit.enabledComponents) without a [tests.<name>] catalog entry or a per-component setting. - Parse the section, merge it across included config files, and carry it into the resolved project config so it appears in 'config dump'. - Reject names that are not defined components, and duplicates (including across files). - Document the section and regenerate the JSON schema and the schema snapshots. 'azldev component test' does not read the list; it is policy for callers.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Enabled-component validation rejects valid spec-discovered components without explicit config entries, causing config loading to fail and blocking config dump and source preparation.
1 open issue
What changed in this PR
Adds [tmt.dist-git].enabled-components as centralized opt-in metadata for components’ dist-git TMT tests. Downstream consumers can read it through config dump; azldev component test behavior remains unchanged.
Changes:
- Adds configuration types, cross-file list merging, and resolved dump output.
- Validates component references, duplicate entries, and empty names.
- Updates configuration documentation, schema, tests, and schema snapshots.
| File | Description |
|---|---|
schemas/azldev.schema.json |
Adds the TMT discovery configuration schema. |
scenario/__snapshots__/TestSnapshotsContainer_config_generate-schema_stdout_1.snap |
Updates the container schema snapshot. |
scenario/__snapshots__/TestSnapshots_config_generate-schema_stdout_1.snap |
Updates the host schema snapshot. |
internal/projectconfig/testsuite.go |
Adds the undefined-component error. |
internal/projectconfig/project.go |
Exposes and validates resolved TMT metadata. |
internal/projectconfig/loader.go |
Appends enablement lists across config files. |
internal/projectconfig/loader_test.go |
Tests merging and reference validation. |
internal/projectconfig/configfile.go |
Defines TMT configuration and validation. |
internal/projectconfig/configfile_test.go |
Tests parsing and list constraints. |
internal/app/azldev/cmds/config/schema_test.go |
Verifies the generated schema shape. |
docs/user/reference/config/tests.md |
Documents dist-git test enablement metadata. |
docs/user/reference/config/config-file.md |
Lists the new top-level tmt section. |
Review effort: Balanced
Comment on lines
+108
to
+109
| if _, ok := components[name]; !ok { | ||
| return fmt.Errorf("%w: %#q", ErrUndefinedTmtDistGitComponent, name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds a top-level
[tmt.dist-git]section so a project can list, in one place, the components whose own dist-git TMT tests are enabled:Motivation
Today the only way to associate TMT tests with a component is a
[tests.<name>]catalog entry (a pinned plan and source) plus atests.testsreference on the component. That fits external suites, but not packages whose upstream dist-git already ships.fmf/andplans/: those would need a duplicated source pin per package and one or more edits to component definitions.For the Azure Linux repo, this keeps a single file (
base/comps/tmt.tests.toml) as the source of truth for enablement. Downstream consumers (ControlTower's metadata service, and the test execution engine) can read the list fromazldev config dumpand run the component's dist-git tests viaazldev component prepare-sources+azldev component test --source-dir.Changes
tmtsection withdist-git.enabled-components(string array).azldev config dump -f jsonnow emitstmt.distGit.enabledComponents. The field is omitted when unused.undefined component in tmt.dist-git.enabled-components), and duplicates are rejected, including across files.schemas/azldev.schema.json, updated thescenarioschema snapshots, and documented the section indocs/user/reference/config/tests.mdandconfig-file.md.Not changed
azldev component testdoes not read the list. It is policy for callers; azldev's existing behavior is unchanged (with--source-dirand no plan, tmt runs every enabled plan it finds).Testing
Run locally, matching the CI jobs:
mage -v unit: pass.mage -v check static,check mod,check licenses: pass.mage check lint: golangci-lint passes. The editorconfig step was verified against tracked files only, because my working tree has unrelated untracked scratch files.mage -v docs/generate: no diff after regeneration.config dumpshows the four enabled components, and a typo in the list fails the load with a clear error.Scenario tests:
TestCheckedInSchemasAreUpToDateand the hostconfig generate-schemasnapshot pass after the update. The Docker-based scenario tests cannot run on my machine (Docker socket permission denied), soTestSnapshotsContainer_config_generate-schema_stdout_1.snapwas updated by copying the host snapshot, which was byte-identical to it before this change. The remaining non-container scenario tests fail identically (27 tests, all the Docker permission error) on an unmodified checkout ofmainand on this branch, so this change adds no failures. CI will run the full scenario suite.Related
Azure Linux metadata that uses this section: microsoft/azurelinux#20501.