Fix broken tests#557
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes broken tests by updating core types to align with schema changes, adjusting struct definitions, and extending GraphQL test queries.
- Updated
InfrastructureResourcereferences to use the ID-only type. - Expanded
InfrastructureResourcestruct fields for JSON serialization. - Added
sbomGenerationConfigurationto GraphQL test queries and corrected GraphQL syntax.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| union.go | Changed TagOwner.InfrastructureResource to use InfrastructureResourceId. |
| infra.go | Replaced embedded ID with explicit Id, Aliases, and Name fields. |
| repository_test.go | Extended queries to include sbomGenerationConfiguration. |
| relationship_test.go | Fixed mutation variable syntax by adding non-null ! and missing comma. |
| cache_test.go | Extended query to include sbomGenerationConfiguration. |
Comments suppressed due to low confidence (3)
infra.go:21
- Field name
Idshould be renamed toIDto follow Go conventions for acronyms and align with the JSON tag.
Id ID `json:"id"`
union.go:56
- [nitpick] The field name
InfrastructureResourceis backed by typeInfrastructureResourceId; consider renaming the field toInfrastructureResourceIdfor clarity.
InfrastructureResource InfrastructureResourceId `graphql:"... on InfrastructureResource"`
relationship_test.go:116
- GraphQL variable definitions are missing a comma between
$identifier: IdentifierInput!and$input: RelationshipDefinitionInput!; add a comma to fix the syntax.
`mutation RelationshipDefinitionUpdate($identifier:IdentifierInput!$input:RelationshipDefinitionInput!){relationshipDefinitionUpdate(relationshipDefinition: $identifier, input: $input){definition{alias,componentType{id,aliases},description,id,metadata{allowedTypes,maxItems,minItems},name},errors{message,path}}}`
| } | ||
|
|
||
| type InfrastructureResource struct { | ||
| InfrastructureResourceId |
There was a problem hiding this comment.
is the struct still used? Should we clean it up, and the reference to it in union.go too?
There was a problem hiding this comment.
Yes it used by the RelationshipResource type - the reason i pulled it out of this is it completely changes the tests for all the infra resource stuff which is unecessary. In the future we'll need to reconcile them but for now adding this was a bad idea and we can just scope it to RelationshipResource
Resolves #
Problem
Tests are broken on the main branch
Solution
All the fixes needed to fix tests
Checklist