[notfication-hubs] Remove the need for BodilessMatcher in the tests with sanitizers#35447
Merged
HarshaNalluru merged 4 commits intoAzure:mainfrom Aug 4, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR removes the flaky BodilessMatcher from notification-hubs tests and replaces it with a more reliable approach using body sanitizers and fake timers. The BodilessMatcher was causing intermittent test failures in the pipeline due to inconsistent activation.
Key changes:
- Replaced
BodilessMatcherwith body sanitizers that handle dynamic timestamps - Added fake timers in playback mode to ensure deterministic test behavior
- Consolidated sanitizer logic into the shared
createRecordedClientContextfunction
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
recordedClient.ts |
Added body sanitizers for timestamps, fake timers for playback mode, and removed browser-specific BodilessMatcher logic |
listRegistrationsByTag.spec.ts |
Removed explicit BodilessMatcher setup |
listRegistrations.spec.ts |
Removed explicit BodilessMatcher setup |
getRegistration.spec.ts |
Removed explicit BodilessMatcher setup |
createOrUpdateRegistration.spec.ts |
Removed explicit BodilessMatcher setup |
assets.json |
Updated test recording assets tag |
sdk/notificationhubs/notification-hubs/test/public/utils/recordedClient.ts
Show resolved
Hide resolved
sdk/notificationhubs/notification-hubs/test/public/utils/recordedClient.ts
Show resolved
Hide resolved
sdk/notificationhubs/notification-hubs/test/public/utils/recordedClient.ts
Show resolved
Hide resolved
…dedClient.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jeremymeng
approved these changes
Aug 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Packages impacted by this PR
@azure/notification-hubsBodiless Matcher is flaky
Bodiless Matcher doesn't always get activated even though registered as part of the test, leading to test failures in the pipeline for some jobs, not all.
I couldn't reproduce the issue locally, but there are several instances of evidence from the pipeline.
azure-sdk-for-js/sdk/notificationhubs/notification-hubs/test/public/listRegistrationsByTag.spec.ts
Line 24 in e7399dc
Noticed by @jeremymeng in the notification-hubs pipeline in JS.
Being addressed by @scbedd at Force entrylock on
matchervalue azure-sdk-tools#11515Fix for
@azure/notification-hubs