From cdd3a31f2f96cd0c72e79c64b836c1ad06430262 Mon Sep 17 00:00:00 2001 From: kinelski Date: Wed, 10 Jun 2020 06:13:04 -0700 Subject: [PATCH] [FormRecognizer] Changing test location to West Central US + Live tests fix (#12677) --- sdk/formrecognizer/Azure.AI.FormRecognizer/src/Constants.cs | 2 -- .../src/FormRecognizerClientOptions.cs | 2 +- .../Azure.AI.FormRecognizer/src/FormTrainingClient.cs | 4 ++-- .../FormRecognizerClient/FormRecognizerClientLiveTests.cs | 2 +- sdk/formrecognizer/test-resources.json | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Constants.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Constants.cs index d577605211c6..542dda9493a9 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Constants.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/Constants.cs @@ -7,8 +7,6 @@ internal static class Constants { public const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; - public const string LocationHeader = "Location"; - public const string OperationLocationHeader = "Operation-Location"; public const string DefaultCognitiveScope = "https://cognitiveservices.azure.com/.default"; diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerClientOptions.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerClientOptions.cs index b24212a309b4..ae439fb82981 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerClientOptions.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormRecognizerClientOptions.cs @@ -58,9 +58,9 @@ internal static string GetVersionString(ServiceVersion version) /// private void AddLoggedHeadersAndQueryParameters() { - Diagnostics.LoggedHeaderNames.Add(Constants.LocationHeader); Diagnostics.LoggedHeaderNames.Add(Constants.OperationLocationHeader); Diagnostics.LoggedHeaderNames.Add("apim-request-id"); + Diagnostics.LoggedHeaderNames.Add("Location"); Diagnostics.LoggedHeaderNames.Add("Strict-Transport-Security"); Diagnostics.LoggedHeaderNames.Add("X-Content-Type-Options"); Diagnostics.LoggedHeaderNames.Add("x-envoy-upstream-service-time"); diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs index dde70622ab73..edb179bc9fe0 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormTrainingClient.cs @@ -318,7 +318,7 @@ public virtual CopyModelOperation StartCopyModel(string modelId, CopyAuthorizati new CopyAuthorizationResult(target.ModelId, target.AccessToken, target.ExpiresOn/*.ToUnixTimeSeconds()*/)); Response response = ServiceClient.CopyCustomModel(guid, request, cancellationToken); - string location = ClientCommon.GetResponseHeader(response.Headers, Constants.LocationHeader); + string location = ClientCommon.GetResponseHeader(response.Headers, Constants.OperationLocationHeader); return new CopyModelOperation(ServiceClient, Diagnostics, location, target.ModelId); } @@ -344,7 +344,7 @@ public virtual async Task StartCopyModelAsync(string modelId new CopyAuthorizationResult(target.ModelId, target.AccessToken, target.ExpiresOn/*.ToUnixTimeSeconds()*/)); Response response = await ServiceClient.CopyCustomModelAsync(guid, request, cancellationToken).ConfigureAwait(false); - string location = ClientCommon.GetResponseHeader(response.Headers, Constants.LocationHeader); + string location = ClientCommon.GetResponseHeader(response.Headers, Constants.OperationLocationHeader); return new CopyModelOperation(ServiceClient, Diagnostics, location, target.ModelId); } diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs index ea07c9a9279d..3c22b0e17af4 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/FormRecognizerClientLiveTests.cs @@ -838,7 +838,7 @@ public async Task StartRecognizeCustomFormsWithoutLabelsCanParseMultipageFormWit /// Recognizer cognitive service and handle returned errors. /// [Test] - [TestCase(true)] + [TestCase(true, Ignore = "https://github.com/Azure/azure-sdk-for-net/issues/12319")] [TestCase(false)] public async Task StartRecognizeCustomFormsFromUriThrowsForNonExistingContent(bool useTrainingLabels) { diff --git a/sdk/formrecognizer/test-resources.json b/sdk/formrecognizer/test-resources.json index 6ee09b540838..db862cc6d9ba 100644 --- a/sdk/formrecognizer/test-resources.json +++ b/sdk/formrecognizer/test-resources.json @@ -11,7 +11,7 @@ }, "location": { "type": "string", - "defaultValue": "[resourceGroup().location]", + "defaultValue": "westcentralus", "metadata": { "description": "The location of the resource. By default, this is the same as the resource group." }