-
Notifications
You must be signed in to change notification settings - Fork 863
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
Generator implementation for V2 smoke tests for C2J files. #3578
base: normj/v4-smoketests
Are you sure you want to change the base?
Conversation
generator/ServiceClientGeneratorLib/Generators/TestFiles/SmokeTestsV2.tt
Show resolved
Hide resolved
} | ||
} | ||
#> | ||
public async Task <#=testCase["id"]?.ToString() ?? "Test"#>() |
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.
Were there tests without an id
field? Seems like a field that would be required.
generator/ServiceClientGeneratorLib/Generators/TestFiles/SmokeTestsV2.tt
Outdated
Show resolved
Hide resolved
} | ||
else | ||
{ | ||
var arrayValues = new List<string>(); |
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.
Can't remember in the SEP can there be arrays of more then just strings.
@@ -8,6 +8,7 @@ | |||
AddLicenseHeader(); | |||
#> | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Threading.Tasks; | |||
using Microsoft.VisualStudio.TestTools.UnitTesting; |
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'm not reviewing the PR, but...) Is there a reason why you're using MSTest as the test framework?
The hand-written files we have right now use xUnit (meaning they can run in parallel) and using xUnit will allow you to test your PR without making any changes to our build system (as long as they're found by the projects in this folder: https://github.com/aws/aws-sdk-net/tree/v4-development/sdk/test/SmokeTests).
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.
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.
unless you want to make a buildsystem change I'd probably listen to daniel here
the file isn't in this PR but shouldn't you remove this logic in
I'm assuming that was just put there for testing purposes, but we should be generating smoke tests for every service |
hmm so actually it is generating it, but then it is being removed and the output of the generator is showing
and that's why it wasn't showing up for me. |
^^ looking into the problem I mentioned above a bit more, it seems like it thinks these generated integ tests are orphaned files because they are not a part of the since it is not part of that list, when it is passed into The removing of the orphaned code should definitely be fixed, since it makes it kind of hard to review without knowing what every smoke test file looks like. |
var response = await serviceClient.<#=modeledOperation.Name#>Async(request); | ||
<# | ||
var input = testCase["input"] as JsonData; | ||
if (input != null && input.IsObject) |
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.
is there a reason we need to check input.IsObject
? if input != null, then we are guaranteed to be given a json object wityh the input so I think we can remove the IsObject
check.
foreach (string jsonKey in input.PropertyNames) | ||
{ | ||
var propertyName = FindPropertyName(modeledOperation, jsonKey); | ||
var value = input[jsonKey]; |
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.
nit: since the name is propertyName
, you could make it consistent and say propertyValue
for the value. fine with me if u dont want to change though
<# | ||
foreach (JsonData tag in value) | ||
{ | ||
if (tag != null && tag.IsObject && tag["Key"] != null && tag["Value"] != null) |
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.
same comment here about IsObject
. Is it required?
return (bool)useAccountIdRouting; | ||
} | ||
|
||
public string[] GetSigV4aRegionSet(JsonData testCase) |
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.
you could just make the return type List<string>
, which would remove the extra regions.ToArray()
call at the end and instead just return regions.
if (IsSuccessExpected(testCase)) | ||
{ | ||
#> | ||
var response = await serviceClient.<#=modeledOperation.Name#>Async(request); |
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.
Add .ConfigureAwait(false)
at the end of this async call. We should always be adding that at the end of async calls, unless you really know what you're doing. See https://devblogs.microsoft.com/dotnet/configureawait-faq/#why-would-i-want-to-use-configureawait(false) for why we should use configureAwait(false)
#> | ||
try | ||
{ | ||
var response = await serviceClient.<#=modeledOperation.Name#>Async(request); |
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.
same comment as above
@@ -8,6 +8,7 @@ | |||
AddLicenseHeader(); | |||
#> | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Threading.Tasks; | |||
using Microsoft.VisualStudio.TestTools.UnitTesting; |
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.
unless you want to make a buildsystem change I'd probably listen to daniel here
Description
Implements the generator for smoke tests v2 format based on the new smoke-2.json schema. Key features:
Questions for review:
Motivation and Context
This implementation supports the new smoke tests format (smoke-2.json) which provides more configuration options and better structure for test cases. The generator creates test files that:
Testing
Types of changes
Checklist
License