Skip to content

Commit 1824e7e

Browse files
authored
[Text Analytics] Increase retries when testing in the China cloud regions (Azure#36375)
1 parent 1d0134b commit 1824e7e

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsClientLiveTestBase.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,19 @@ public TextAnalyticsClient GetClient(
4949
? TestEnvironment.StaticEndpoint
5050
: TestEnvironment.Endpoint);
5151

52+
TextAnalyticsAudience audience = TestEnvironment.GetAudience();
53+
5254
options ??= new TextAnalyticsClientOptions(ServiceVersion)
5355
{
54-
Audience = TestEnvironment.GetAudience()
56+
Audience = audience
5557
};
5658

57-
// While we use a persistent resource for live tests, we need to increase our retries.
58-
// We should remove when having dynamic resource again
59-
// Issue: https://github.com/Azure/azure-sdk-for-net/issues/25041
60-
if (useStaticResource)
59+
// We have seen transient timeouts while testing the custom text analysis features which are potentially
60+
// related to the use of the static resource.
61+
// TODO: https://github.com/Azure/azure-sdk-for-net/issues/25041.
62+
// Similarly, we have also seen transient timeouts when running tests in the China cloud regions which are
63+
// likely due to the physical distance between those regions and our CI infrastructure running in the US.
64+
if (useStaticResource || audience == TextAnalyticsAudience.AzureChina)
6165
{
6266
options.Retry.MaxRetries = MaxRetriesCount;
6367
}
@@ -80,7 +84,7 @@ public TextAnalyticsClient GetClient(
8084

8185
// This has been added to stop the custom tests to run forever while we
8286
// get more reliable information on which scenarios cause timeouts.
83-
// Issue https://github.com/Azure/azure-sdk-for-net/issues/25152
87+
// TODO: https://github.com/Azure/azure-sdk-for-net/issues/25152
8488
internal static async Task PollUntilTimeout<T>(Operation<T> operation, int timeoutInMinutes = 20)
8589
{
8690
TimeSpan pollingInterval = TimeSpan.FromSeconds(10);

sdk/textanalytics/Azure.AI.TextAnalytics/tests/Infrastructure/TextAnalyticsSampleBase.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ public class TextAnalyticsSampleBase : SamplesBase<TextAnalyticsTestEnvironment>
1212

1313
public TextAnalyticsClientOptions CreateSampleOptions(bool useStaticResource = default)
1414
{
15+
TextAnalyticsAudience audience = TestEnvironment.GetAudience();
16+
1517
TextAnalyticsClientOptions options = new()
1618
{
17-
Audience = TestEnvironment.GetAudience()
19+
Audience = audience
1820
};
1921

20-
// While we use a persistent resource for live tests, we need to increase our retries.
21-
// We should remove when having dynamic resource again
22-
// Issue: https://github.com/Azure/azure-sdk-for-net/issues/25041
23-
if (useStaticResource)
22+
// We have seen transient timeouts while testing the custom text analysis features which are potentially
23+
// related to the use of the static resource.
24+
// TODO: https://github.com/Azure/azure-sdk-for-net/issues/25041.
25+
// Similarly, we have also seen transient timeouts when running tests in the China cloud regions which are
26+
// likely due to the physical distance between those regions and our CI infrastructure running in the US.
27+
if (useStaticResource || audience == TextAnalyticsAudience.AzureChina)
2428
{
2529
options.Retry.MaxRetries = MaxRetriesCount;
2630
}

0 commit comments

Comments
 (0)