-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Recorder] configureClientOptions
method on the recorder
#20175
Conversation
configureClientOptions
method on the recorder
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
… harshan/issue/16876
… harshan/issue/16876
@@ -197,15 +197,15 @@ describe("[AAD] Attestation Client", function () { | |||
const binaryRuntimeData = base64url.decodeString(_runtimeData); | |||
const client = createRecordedClient(recorder, endpointType); | |||
|
|||
{ | |||
// You can't specify both runtimeData and runtimeJson. | |||
await expect( |
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.
expect wasn't capturing somehow.
Maybe a breaking change or something, hence updated to assert
instead.
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 changes to the test contract look perfect!
Just had some minor feedback on how to clean up the issue in attestationClient
.
} else if (clientOptions !== undefined) { | ||
} | ||
|
||
// If arg3 is defined, it has to be clientOptions and arg2 has to be a token credential |
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 think we can also ditch the initial assignment to options
, since clientOptions
has a default value that isn't undefined
I think we can simplify everything in this constructor to something like
if(credentialsOrOptions && isTokenCredential(credentialsOrOptions)) {
credential = credentialsOrOptions;
credentialScopes = ["https://attest.azure.net/.default"];
options = clientOptions;
} else {
options = credentialsOrOptions;
}
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.
perfect, updated as suggested
… harshan/issue/16876
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.
Changes look great! Nice that we landed on a sensible public API for this
* Renamed `AttestationResponse.value` to `AttestationResponse.body` to align with | ||
API guidelines. | ||
- Renamed `AttestationResponse.value` to `AttestationResponse.body` to align with | ||
API guidelines. |
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.
Wait, are these changes necessary?
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.
prettier did this.
sdk/test-utils/recorder/CHANGELOG.md
Outdated
Leveraging the new option, `configureClientOptions` method is added to the `Recorder`. | ||
[#20175](https://github.com/Azure/azure-sdk-for-js/pull/20175) | ||
|
||
With the support from the new `Recorder#configureClientOptions` method, we no longer need the `Recorder#configureClient` that used to access the private "pipeline" object internal to the client to add/modify the policies. [#20175](https://github.com/Azure/azure-sdk-for-js/pull/20175) removes the `Recorder#configureClient` along with the new addition. |
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 here. I don’t think this indentation applies.
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.
updated all the changelog related indentations
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.
Looks good! — Make sure to get another approval as well 🙂
options = clientOptions; | ||
} else { | ||
options = credentialsOrOptions || {}; |
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: You can use ??
here. Not a big deal but it is semantically clearer.
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 don't want to kick off another 100 builds again. 🥲
I'll consider the change if I am making any other significant commit 🙂
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.
Looks great!
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.
Looks good!
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.
Looks good! One minor question
const client = new TableServiceClient( | ||
assertEnvironmentVariable("TABLES_URL"), | ||
credential, | ||
recorder.configureClientOptions({}) |
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: is it possible to also accept undefined
? I am thinking of the case where I already have an options?
of the original client options type and pass it 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.
Can do.
I didn't want to do that, just to force the users to pass something..
to not have any confusion when they actually want to pass options.
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.
If you feel strongly, I can allow undefined.
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.
Either way is fine.
Packages impacted by this PR
Anyone who's using the new recorder or the perf framework
Issues associated with this PR
#16876 #19859
Fixes #16876
Describe the problem that is addressed by this PR
Now that #19920 - "additionalPolicies array in the client options" is merged, this PR adds 725c2d9 (configureClientOptions method) for both the perf framework and the recorder.
Listing all the changes below.
configureClientOptionsCoreV1
andconfigureClientOptions
methodsRecordings should ideally not be impacted by these changes and should work fine as before.