Skip to content

Fix broken tests#557

Merged
rocktavious merged 1 commit into
mainfrom
kr/fix-main-branch-tests
May 28, 2025
Merged

Fix broken tests#557
rocktavious merged 1 commit into
mainfrom
kr/fix-main-branch-tests

Conversation

@rocktavious
Copy link
Copy Markdown
Contributor

Resolves #

Problem

Tests are broken on the main branch

Solution

All the fixes needed to fix tests

Checklist

  • I have run this code, and it appears to resolve the stated issue.
  • This PR does not reduce total test coverage
  • This PR has no user interface changes or has already received approval from product management to change the interface.
  • Does this change require a Terraform schema change?
    • If so what is the ticket or PR #
  • Make a changie entry that explains the customer facing outcome of this change

@rocktavious rocktavious self-assigned this May 27, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 InfrastructureResource references to use the ID-only type.
  • Expanded InfrastructureResource struct fields for JSON serialization.
  • Added sbomGenerationConfiguration to 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 Id should be renamed to ID to follow Go conventions for acronyms and align with the JSON tag.
Id           ID                                 `json:"id"`

union.go:56

  • [nitpick] The field name InfrastructureResource is backed by type InfrastructureResourceId; consider renaming the field to InfrastructureResourceId for 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}}}`

Comment thread infra.go
}

type InfrastructureResource struct {
InfrastructureResourceId
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the struct still used? Should we clean it up, and the reference to it in union.go too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@rocktavious rocktavious merged commit d0fbc7d into main May 28, 2025
5 checks passed
@rocktavious rocktavious deleted the kr/fix-main-branch-tests branch May 28, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants