-
Notifications
You must be signed in to change notification settings - Fork 243
Added new ERROR event to EndpointTestsTraitValidator when builtin params are inconsistent #2955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a96157d
Add EndpointTestCasesParamsValidator which currently checks for incon…
rchache a50bacf
Merge branch 'smithy-lang:main' into main
rchache 2e40d11
Apply suggestions from code review
rchache a979556
unroll streams to loops
rchache 0c00229
move validations to EndpointTestsTraitValidator
rchache 611fbde
remove unnecessary null checks
rchache 509a91b
added changelog entry
rchache File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...s/software/amazon/smithy/rulesengine/traits/errorfiles/inconsistent-builtin-params.errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait.smithy.rules#endpointRuleSet | ||
| [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait.smithy.rules#endpointTests | ||
| [ERROR] example#FizzBuzz: Inconsistent testcase parameters: https://another.example.com and https://custom.example.com | EndpointTestsTrait |
82 changes: 82 additions & 0 deletions
82
...s/software/amazon/smithy/rulesengine/traits/errorfiles/inconsistent-builtin-params.smithy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| $version: "1.0" | ||
|
|
||
| namespace example | ||
|
|
||
| use smithy.rules#endpointRuleSet | ||
| use smithy.rules#endpointTests | ||
|
|
||
| @endpointRuleSet({ | ||
| "version": "1.3", | ||
| parameters: { | ||
| endpoint: { | ||
| type: "string" | ||
| builtIn: "SDK::Endpoint" | ||
| documentation: "docs" | ||
| } | ||
| }, | ||
| "rules": [ | ||
| { | ||
| "conditions": [], | ||
| "documentation": "base rule", | ||
| "endpoint": { | ||
| "url": "https://fizzbuzz.amazonaws.com", | ||
| "headers": {} | ||
| }, | ||
| "type": "endpoint" | ||
| } | ||
| ] | ||
| }) | ||
| @endpointTests( | ||
| version: "1.3", | ||
| testCases: [ | ||
| { | ||
| "documentation": "Inconsistent", | ||
| "params": { | ||
| endpoint: "https://another.example.com" | ||
| }, | ||
| "expect": { | ||
| "endpoint": { | ||
| "url": "https://fizzbuzz.amazonaws.com" | ||
| } | ||
| }, | ||
| "operationInputs": [ | ||
| { | ||
| "operationName": "ListShards", | ||
| "builtInParams": { | ||
| "SDK::Endpoint": "https://custom.example.com", | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| { | ||
| "documentation": "Consistent", | ||
| "params": { | ||
| endpoint: "https://another.example.com" | ||
| }, | ||
| "expect": { | ||
| "endpoint": { | ||
| "url": "https://fizzbuzz.amazonaws.com" | ||
| } | ||
| }, | ||
| "operationInputs": [ | ||
| { | ||
| "operationName": "ListShards", | ||
| "builtInParams": { | ||
| "SDK::Endpoint": "https://another.example.com", | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| ) | ||
| service FizzBuzz { | ||
| operations: [ | ||
| ListShards | ||
| ] | ||
| } | ||
|
|
||
| operation ListShards { | ||
| input: Struct | ||
| } | ||
|
|
||
| structure Struct {} |
2 changes: 1 addition & 1 deletion
2
...es/software/amazon/smithy/rulesengine/traits/errorfiles/non-default-builtin-values.errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| [WARNING] smithy.example#ExampleService: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait | ||
| [WARNING] smithy.example#ExampleService: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait | ||
| [ERROR] smithy.example#ExampleService: Test case does not supply the `"https://another.example.com"` value for the `endpoint` parameter's `SDK::Endpoint` built-in. | EndpointTestsTrait | ||
| [ERROR] smithy.example#ExampleService: Inconsistent testcase parameters: https://another.example.com and https://custom.example.com | EndpointTestsTrait | ||
| [ERROR] smithy.example#ExampleService: Test case does not supply the `"https://some.example.com"` value for the `endpoint` parameter's `SDK::Endpoint` built-in. | EndpointTestsTrait |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is only a partial/bandaid fix. there is still a bug in
extractTestSuiteParametersthat double counts and causes testSuiteParams to be larger than it should be.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a plan to get the root cause fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look and it seemed fairly complicated at least to me. I didn't want to accidentally create a regression, so I did this minimal fix for now