Skip to content

Commit

Permalink
Fix breaking-change unit test (#12693)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottSuarez authored Jan 6, 2025
1 parent c377f37 commit 9e815a4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/unit-test-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ permissions: read-all
on:
pull_request:
paths:
- 'docs/**'
- 'tools/**'
- '.github/workflows/unit-test-tools.yml'

Expand Down
2 changes: 1 addition & 1 deletion tools/diff-processor/breaking_changes/breaking_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type BreakingChange struct {
RuleName string
}

const breakingChangesPath = "develop/breaking-changes/breaking-changes"
const breakingChangesPath = "breaking-changes/breaking-changes"

func NewBreakingChange(message, identifier string) BreakingChange {
return BreakingChange{
Expand Down
24 changes: 12 additions & 12 deletions tools/diff-processor/breaking_changes/breaking_changes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestComputeBreakingChanges(t *testing.T) {
wantViolations: []BreakingChange{
{
Message: "Resource `google-x` was either removed or renamed",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#resource-map-resource-removal-or-rename",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#resource-map-resource-removal-or-rename",
},
},
},
Expand All @@ -118,7 +118,7 @@ func TestComputeBreakingChanges(t *testing.T) {
wantViolations: []BreakingChange{
{
Message: "Field `field-b` within resource `google-x` was either removed or renamed",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#resource-schema-field-removal-or-rename",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#resource-schema-field-removal-or-rename",
},
},
},
Expand All @@ -143,7 +143,7 @@ func TestComputeBreakingChanges(t *testing.T) {
wantViolations: []BreakingChange{
{
Message: "Field `field-a` changed from optional to required on `google-x`",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#field-optional-to-required",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#field-optional-to-required",
},
},
},
Expand All @@ -167,11 +167,11 @@ func TestComputeBreakingChanges(t *testing.T) {
wantViolations: []BreakingChange{
{
Message: "Field `field-a` changed from optional to required on `google-x`",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#field-optional-to-required",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#field-optional-to-required",
},
{
Message: "Field `field-b` within resource `google-x` was either removed or renamed",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#resource-schema-field-removal-or-rename",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#resource-schema-field-removal-or-rename",
},
},
},
Expand Down Expand Up @@ -200,15 +200,15 @@ func TestComputeBreakingChanges(t *testing.T) {
wantViolations: []BreakingChange{
{
Message: "Field `field-a` changed from optional to required on `google-x`",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#field-optional-to-required",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#field-optional-to-required",
},
{
Message: "Field `field-b` within resource `google-x` was either removed or renamed",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#resource-schema-field-removal-or-rename",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#resource-schema-field-removal-or-rename",
},
{
Message: "Resource `google-y` was either removed or renamed",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#resource-map-resource-removal-or-rename",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#resource-map-resource-removal-or-rename",
},
},
},
Expand Down Expand Up @@ -254,7 +254,7 @@ func TestComputeBreakingChanges(t *testing.T) {
wantViolations: []BreakingChange{
{
Message: "Field `field-a.sub-field-2` within resource `google-x` was either removed or renamed",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#resource-schema-field-removal-or-rename",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#resource-schema-field-removal-or-rename",
},
},
},
Expand Down Expand Up @@ -299,7 +299,7 @@ func TestComputeBreakingChanges(t *testing.T) {
wantViolations: []BreakingChange{
{
Message: "Field `field-a.sub-field-1` MinItems went from 100 to 25 on `google-x`",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#field-shrinking-max",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#field-shrinking-max",
},
},
},
Expand Down Expand Up @@ -344,7 +344,7 @@ func TestComputeBreakingChanges(t *testing.T) {
wantViolations: []BreakingChange{
{
Message: "Field `field-a.sub-field-1` MinItems went from 100 to 25 on `google-x`",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#field-shrinking-max",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#field-shrinking-max",
},
},
},
Expand Down Expand Up @@ -375,7 +375,7 @@ func TestComputeBreakingChanges(t *testing.T) {
wantViolations: []BreakingChange{
{
Message: "Field `field-a` MinItems went from 1 to 4 on `google-x`",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/develop/breaking-changes/breaking-changes#field-growing-min",
DocumentationReference: "https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes#field-growing-min",
},
},
},
Expand Down

0 comments on commit 9e815a4

Please sign in to comment.