Skip to content
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

Endpoint test generator produces code with non-deterministic order #2119

Closed
jdisanti opened this issue Dec 20, 2022 · 1 comment · Fixed by #2125
Closed

Endpoint test generator produces code with non-deterministic order #2119

jdisanti opened this issue Dec 20, 2022 · 1 comment · Fixed by #2125
Assignees
Labels
bug Something isn't working client sdk-ga

Comments

@jdisanti
Copy link
Collaborator

In a PR unrelated to endpoints, I noticed the PR Bot's diff showed a reordering of all the endpoint test param insertions. For example:

                 .property(
                     "authSchemes",
                     vec![aws_smithy_types::Document::from({
                         let mut out =
                             std::collections::HashMap::<String, aws_smithy_types::Document>::new();
-                        out.insert("name".to_string(), "sigv4".to_string().into());
                         out.insert("disableDoubleEncoding".to_string(), true.into());
+                        out.insert("name".to_string(), "sigv4".to_string().into());
                         out.insert("signingName".to_string(), "s3".to_string().into());
                         out.insert("signingRegion".to_string(), "us-west-2".to_string().into());
                         out
                     })]
                 )

All the code in this highlighted area needs to use deterministic ordering when iterating over Map types:
https://github.com/awslabs/smithy-rs/blob/a15ce735b9209e42d2e4ea2025ce92cca9d91e0b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointTestGenerator.kt#L100-L152

@jdisanti jdisanti added bug Something isn't working client sdk-ga labels Dec 20, 2022
@jdisanti
Copy link
Collaborator Author

Saw it on another PR unrelated to endpoints:

                 .property(
                     "authSchemes",
                     vec![aws_smithy_types::Document::from({
                         let mut out =
                             std::collections::HashMap::<String, aws_smithy_types::Document>::new();
-                        out.insert("signingName".to_string(), "s3-outposts".to_string().into());
                         out.insert("signingRegion".to_string(), "us-east-2".to_string().into());
-                        out.insert("disableDoubleEncoding".to_string(), true.into());
                         out.insert("name".to_string(), "sigv4".to_string().into());
+                        out.insert("signingName".to_string(), "s3-outposts".to_string().into());
+                        out.insert("disableDoubleEncoding".to_string(), true.into());
                         out
                     })]
                 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working client sdk-ga
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants