-
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
Changes from 5 commits
a96157d
a50bacf
2e40d11
a979556
0c00229
611fbde
509a91b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -271,7 +271,7 @@ private void validateTestsParameters( | |
|
|
||
| // All required params from a ruleset must be present in all test cases. | ||
| if (parameter.isRequired() && !parameter.getDefault().isPresent() | ||
| && (!testSuiteHasParam || testSuiteParams.get(name).size() != trait.getTestCases().size())) { | ||
| && (!testSuiteHasParam || testSuiteParams.get(name).size() < trait.getTestCases().size())) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a plan to get the root cause fixed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| errors.add(parameterError(serviceShape, | ||
| parameter, | ||
| "TestCase.RequiredMissing", | ||
|
|
||
| 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 |
| 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 {} |
| 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 |
Uh oh!
There was an error while loading. Please reload this page.