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 2 commits 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
bd478bd to
fafc0c1
Compare
fafc0c1 to
f1e6eb3
Compare
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?
|
Thanks for your patience -- I went through this in detail yesterday; lots of goodness here. I've created a branch based on the work that also adds some additional proposed changes. I'll be sending it out during my day today. Some of my main comments/questions:
I'll follow up with more details later today. |
9064645 to
8ab6361
Compare
| "kind": { | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "type": "array", | ||
| "title": "Kind", | ||
| "description": "Test kind hints (e.g. functional or performance)" | ||
| }, |
7693b03 to
c5fb905
Compare
| // Type identifies the framework/runner. Required, and constrained to the | ||
| // closed enum in the schema tag at the schema layer. The loader still | ||
| // accepts unknown values permissively; the resolver is the source of truth. | ||
| Type string `toml:"type" json:"type" jsonschema:"required,title=Type,description=Test framework type,enum=pytest,enum=lisa,enum=tmt"` |
| // TestRef is a reference to either a test (by name) or another group (by name). | ||
| // Exactly one of Name or Group should be set; semantic validation is the resolver's | ||
| // responsibility. |
| if err := validateTestDefinitions(f.Tests); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if err := validateNewTestReferences(f); err != nil { | ||
| return err | ||
| } |
Thank you @liunan-ms for pointing this out. |
Hi @reubeno For this iteration, I have already tightened a few areas:
One important migration concern is ControlTower compatibility. Today, ControlTower consumes testSuites and derives TestSuiteDetails from that contract. If we remove those fields before ControlTower is updated, we risk missing test metadata and skipping validation task wiring. To avoid breakage, I propose this rollout:
I agree with your points on unifying test-suites and tests strengthening validation and expanding unit coverage. I will incorporate those as part of the migration work. I am looking forward to your suggestions on the migration. |
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.