Skip to content

Commit 6b5be97

Browse files
committed
update default sanitizers so that tenantId won't shatter
1 parent 3387b10 commit 6b5be97

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

core/Azure.Mcp.Core/tests/Azure.Mcp.Tests/Client/RecordedCommandTestsBase.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ public abstract class RecordedCommandTestsBase(ITestOutputHelper output, TestPro
7373
/// Grab the names from the test-proxy source at https://github.com/Azure/azure-sdk-tools/blob/main/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs#L65)
7474
/// Default Set:
7575
/// - `AZSDK3430`: `$..id`
76+
/// The default replaces to all 0s, but we have some command-line tests that will throw on empty GUID for tenant,
77+
/// so we will remove this default sanitizer, and add a more specific one that only replaces with all 0s ending with 1.
78+
/// Still recognizably a GUID, but still a fake one.
79+
/// - `AZSDK3443`: `$..tenantId`
7680
/// </summary>
77-
public virtual List<string> DisabledDefaultSanitizers { get; } = new() { "AZSDK3430" };
81+
public virtual List<string> DisabledDefaultSanitizers { get; } = new() { "AZSDK3430", "AZSDK3443" };
7882

7983
/// <summary>
8084
/// During recording, variables saved to this dictionary will be propagated to the test-proxy and saved in the recording file.
@@ -225,12 +229,17 @@ private void PopulateDefaultSanitizers()
225229
if (EnableDefaultSanitizerAdditions)
226230
{
227231
// Sanitize out the resource basename by default!
228-
// This implies that tests shouldn't use this baseresourcename as part of their validation logic, as sanitization will replace it with "Sanitized" and cause confusion.
232+
// This implies that tests shouldn't use this baseresourcename as part of their validation logic, as sanitization will replace it with "Sanitized" and cause confusion during playback.
229233
GeneralRegexSanitizers.Add(new GeneralRegexSanitizer(new GeneralRegexSanitizerBody()
230234
{
231235
Regex = Settings.ResourceBaseName,
232236
Value = "Sanitized",
233237
}));
238+
BodyKeySanitizers.Add(new BodyKeySanitizer(new BodyKeySanitizerBody()
239+
{
240+
Key = "$..tenantId",
241+
Value = "00000000-0000-0000-0000-000000000001",
242+
}));
234243
}
235244
}
236245

0 commit comments

Comments
 (0)