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

[Unified Recorder] Re-enable ContinuationSanitizer tests #18841

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions sdk/test-utils/recorder-new/test/testProxyTests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function getTestServerUrl() {
);
});

it.skip("ContinuationSanitizer", async () => {
it("ContinuationSanitizer", async () => {
Copy link
Member

@HarshaNalluru HarshaNalluru Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention behind this sanitizer is to handle a case at ACR service.
Right now, the proxy tool only supports continuation sanitizer only in the headers I think.
I (vaguely) remember the ACR case to have the id at request body.

If the sanitizer can't be used for that case, it's pretty much worthless.
Can you test that case on your local, observe the changes in the recordings to understand, and then see what else we'd need to add in the proxy tool to support such a case?
@jeremymeng should be able to point you to the test case from ACR.

After you test using the ACR test, add a new test or update this test to represent the exact scenario over there.
Add more/different routes to the server under utils as needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name Continuation doesn't ring a bell. In ACR I had to sanitize part of the token value while keeping expiration info. I also had to call pluginForClientSecretCredentialTests(env.CONTAINERREGISTRY_TENANT_ID) but I don't remember the exact reason now.

customizationsOnRecordings: [
(recording: string): string =>
recording.replace(
/"refresh_token":"[^"]+"/g,
`"refresh_token":"sanitized.${expiryReplacement}.sanitized"`
),
(recording: string): string =>
recording.replace(/access_token=(.+?)(&|")/, `access_token=access_token$2`),
(recording: string): string =>
recording.replace(
/refresh_token=([^&]+?)(&|")/,
`refresh_token=sanitized.${expiryReplacement}.sanitized$2`
)
],
onLoadCallbackForPlayback: () => {
pluginForClientSecretCredentialTests(env.CONTAINERREGISTRY_TENANT_ID);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeremymeng this is about some UUID that is present as part of the response of one request, is passed as part of a future request of the same test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked to Jeremy, and turns out this wasn't the requirement.
Let's move on with what we have and revisit if we need to support something else while migrating the tests.

await recorder.start({
envSetupForPlayback: {},
sanitizerOptions: {
Expand All @@ -282,11 +282,6 @@ function getTestServerUrl() {
undefined
);

// Seems to fail with
// Unable to find a record for the request GET http://host.docker.internal:8080/sample_response
// Header differences:
// <your_uuid> values differ, request <985e1725-6d96-467c-89fc-fe45ef0409e4>, record <7460db09-3140-4f76-b59c-16f23e91bc4c>
// TODO: Scott is working on fixing the sanitizer
await makeRequestAndVerifyResponse(
{
path: `/sample_response`,
Expand Down