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.
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
[datadog_synthetics_test] Fix multistep client certificate #2683
base: master
Are you sure you want to change the base?
[datadog_synthetics_test] Fix multistep client certificate #2683
Changes from all commits
1f5abbc
799a190
39eb57b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Let's keep this function pure, just returning the right structure, and overriding here.
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.
The overriding is quite complexe due to the nested structure of
stepMap["request_client_certificate"]
-> arrays of 1 object containing arrays of 1 object etc.completeSyntheticsTestRequest
expects the weird structure as a param, and then callsbuildDatadogRequestCertificates
to create the right structure for the certificate, so we can't create it beforehand.If we want to override without any mutation, it will be easier to create a deepCopy of
stepMap["request_client_certificate"]
, then override it and return the finale clientCertificate.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 don't do anything with the returned error - is it expected?
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.
Mutation is to be avoided as much as possible. Instead, let's have this function return the
requestClientCertificates
interface, and override it in the caller.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.
Agreed that we should avoid the mutation. However,
completeSyntheticsTestRequest
is not expecting a nicely formattedrequestClientCertificates
, but rather a rawstepMap["request_client_certificate"]
with a more complexe structure. So thebuildDatadogRequestClientCertificate
does not really make sense, even more that we already have thebuildDatadogRequestCertificates
function which kinda does the same thing, inside ofcompleteSyntheticsTestRequest
.