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

[Communication Chat] Migrate communication-chat tests to the new recorder #20278

Merged

Conversation

HarshaNalluru
Copy link
Member

@HarshaNalluru HarshaNalluru commented Feb 9, 2022

As the title says, this PR migrates the Communication chat tests to the new recorder.

Follows the migration guide at https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/test-utils/recorder/MIGRATION.md

Note

The new recorder requires test-proxy to be run before running the tests.
For this, "docker" needs to be installed in your environment as suggested at https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/test-utils/recorder/MIGRATION.md#prerequisites.

Part of #19859

@HarshaNalluru
Copy link
Member Author

/azp run js - communication-chat - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@HarshaNalluru HarshaNalluru marked this pull request as ready for review February 9, 2022 06:57
@HarshaNalluru
Copy link
Member Author

/azp run js - communication-chat - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

recorder = await createRecorder(this.currentTest);
if (!communicationUserToken) {
communicationUserToken = await createTestUser(recorder);
await recorder.setMatcher("HeaderlessMatcher");
Copy link
Member Author

@HarshaNalluru HarshaNalluru Feb 9, 2022

Choose a reason for hiding this comment

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

[Just FYI]

Headerless matcher matches the requests in playback without matching the headers in the recording.
Beyond the default skipped headers(to match), there was a new header specific to the communication service I believe, that was being dynamic. Hence using the headerless matcher.

There is going to be a custom-matcher soon from the test-proxy tool and the recorder, which will allow specifying the headers to be ignored while matching. Until then(even forever tbh), the Headerless matcher should be good and should do the job.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation! Yes, our services return a dynamic ms-cv correlation vector.

Copy link
Member

@DominikMe DominikMe left a comment

Choose a reason for hiding this comment

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

Thank you a lot for doing this migration Harsha!

It looks good except for one sanitization piece which seems to have escaped the sanitizer.

recorder = await createRecorder(this.currentTest);
if (!communicationUserToken) {
communicationUserToken = await createTestUser(recorder);
await recorder.setMatcher("HeaderlessMatcher");
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation! Yes, our services return a dynamic ms-cv correlation vector.

actualConnString: env["COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING"] || undefined,
},
],
bodyKeySanitizers: [{ jsonPath: "$.accessToken.token", value: fakeToken }],
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this didn't catch it.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that's the fakeToken which also looks like a real token. 🥲

@HarshaNalluru
Copy link
Member Author

/azp run js - aggregate-reports

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants