feat(projectconfig): accept [tests] and [test-groups] schema in config#229
feat(projectconfig): accept [tests] and [test-groups] schema in config#229bhagyapathak wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for a “new-shape” test configuration schema by introducing first-class project-level test definitions and groups, and enabling images/components to reference them.
Changes:
- Introduces
TestDefinition,TestGroup,TestRef, andComponentTestsConfigtypes for the new schema. - Extends
ConfigFile,ImageTestsConfig, andComponentConfigto carry new test/group references. - Updates fingerprint decision test to exclude component test-selection metadata from build inputs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/projectconfig/tests.go | Adds the new schema types for tests, groups, and references. |
| internal/projectconfig/configfile.go | Adds top-level [tests] and [test-groups] maps to the config shape. |
| internal/projectconfig/image.go | Allows images to reference tests/groups via ImageTestsConfig.Tests. |
| internal/projectconfig/component.go | Allows components to reference tests/groups and deep-copies the new field. |
| internal/projectconfig/fingerprint_test.go | Excludes ComponentConfig.Tests from fingerprint build inputs. |
f0e30ee to
b44cb81
Compare
b44cb81 to
f7dbf0e
Compare
f7dbf0e to
c01da5d
Compare
c01da5d to
bd478bd
Compare
| "name": { | ||
| "type": "string", | ||
| "title": "Name", | ||
| "description": "Name of a test (mutually exclusive with group)" | ||
| }, | ||
| "group": { | ||
| "type": "string", | ||
| "title": "Group", | ||
| "description": "Name of a test group (mutually exclusive with name)" | ||
| } |
bd478bd to
fafc0c1
Compare
fafc0c1 to
f1e6eb3
Compare
| Tests: &projectconfig.ImageTestsConfig{ | ||
| TestSuites: []projectconfig.TestSuiteRef{ | ||
| {Name: "smoke"}, |
f1e6eb3 to
86e4307
Compare
86e4307 to
9064645
Compare
| func (TestRef) JSONSchemaExtend(schema *jsonschema.Schema) { | ||
| // Exactly one of name|group: encoded as oneOf with `required` on each and | ||
| // `not` excluding the other, which forbids both `{}` and `{name, group}`. | ||
| schema.OneOf = []*jsonschema.Schema{ | ||
| {Required: []string{"name"}, Not: &jsonschema.Schema{Required: []string{"group"}}}, | ||
| {Required: []string{"group"}, Not: &jsonschema.Schema{Required: []string{"name"}}}, | ||
| } |
liunan-ms
left a comment
There was a problem hiding this comment.
The new shape seems a superset of tmt, lisa, and pytest, other fields like required-capabilities, reusable groups, and per-component references. Is this intended as the next-generation replacement for test-suites? If yes, is there a migration path designed?
| func (t TestDefinition) Validate(testName string) error { | ||
| if t.Type == "" { | ||
| return fmt.Errorf("%w: test %#q is missing required field 'type'", ErrMissingTestField, testName) | ||
| } | ||
|
|
||
| switch t.Type { | ||
| case "pytest": | ||
| return t.validatePytest(testName) | ||
|
|
||
| case "lisa": | ||
| return t.validateLisa(testName) | ||
|
|
||
| case "tmt": | ||
| return t.validateTmt(testName) | ||
|
|
||
| default: | ||
| return fmt.Errorf("%w: %#q (test: %#q)", ErrUnknownTestType, t.Type, testName) | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
The validatePytest(), validateLisa, validateTmt functions are near-identical: each checks "my subtable is present" and "the other two are absent." They can be consolidated into Validate().
Adds a parse-only schema for declaring tests and reusable test groups in project TOML, plus matching per-component and per-image test reference lists.