From 8b19208378bf030713dabf3acc4086e159ad0226 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Mon, 17 Jul 2023 11:04:15 +0800 Subject: [PATCH] Ignore api-version for mgmt tests (#37582) --- .../Redesign/ManagementRecordedTestBase.cs | 84 +------------------ 1 file changed, 4 insertions(+), 80 deletions(-) diff --git a/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs b/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs index ba12e698ad253..7c629df896f97 100644 --- a/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs +++ b/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs @@ -39,7 +39,7 @@ public abstract class ManagementRecordedTestBase : RecordedTestBas private ResourceType _resourceType; protected string ApiVersion { get; } - protected ManagementRecordedTestBase(bool isAsync, RecordedTestMode? mode = default, bool ignoreArmCoreDependencyVersions = true) + protected ManagementRecordedTestBase(bool isAsync, RecordedTestMode? mode = default) : base(isAsync, mode) { AdditionalInterceptors = new[] { new ManagementInterceptor(this) }; @@ -47,14 +47,11 @@ protected ManagementRecordedTestBase(bool isAsync, RecordedTestMode? mode = defa SessionEnvironment = new TEnvironment(); SessionEnvironment.Mode = Mode; Initialize(); - if (ignoreArmCoreDependencyVersions) - { - IgnoreArmCoreDependencyVersions(); - } + IgnoredQueryParameters.Add("api-version"); } - protected ManagementRecordedTestBase(bool isAsync, ResourceType resourceType, string apiVersion, RecordedTestMode? mode = default, bool ignoreArmCoreDependencyVersions = true) - : this(isAsync, mode, ignoreArmCoreDependencyVersions) + protected ManagementRecordedTestBase(bool isAsync, ResourceType resourceType, string apiVersion, RecordedTestMode? mode = default) + : this(isAsync, mode) { _resourceType = resourceType; ApiVersion = apiVersion; @@ -71,79 +68,6 @@ private void Initialize() _waitForCleanup = Mode == RecordedTestMode.Live ? WaitUntil.Completed : WaitUntil.Started; } - private void IgnoreArmCoreDependencyVersions() - { - // Ignore the api-version of tenant operations - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/tenants\?api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - // Ignore the api-version of subscription operations - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/subscriptions/[^/]+api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/subscriptions/([^/]+)/locations\?api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - // Ignore the api-version of resource group operations - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/resourcegroups/[^/]+api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - // Ignore the api-version of LRO query status operation for resource group deletion - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/subscriptions/[^/]+/operationresults/[^/]+api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - // Ignore the api-version of TagResource operations - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/providers/Microsoft.Resources/tags/default\?api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - // Ignore the api-version of the operation to query resource providers - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/providers/([^/]+)api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - // Ignore the api-version of PolicyAssignments operations - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/providers\/Microsoft.Authorization\/policyAssignments(.*?)\?api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - // Ignore the api-version of PolicyDefinitions operations - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/providers\/Microsoft.Authorization\/policyDefinitions(.*?)\?api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - // Ignore the api-version of PolicySetDefinitions operations - UriRegexSanitizers.Add(new UriRegexSanitizer( - @"/providers\/Microsoft.Authorization\/policySetDefinitions(.*?)\?api-version=(?[a-z0-9-]+)", "**" - ) - { - GroupForReplace = "group" - }); - } - protected void IgnoreNetworkDependencyVersions() { // Ignore the api-version of Network operations