Skip to content

Commit

Permalink
Implement RetryOnInternalServerErrorAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
joseharriaga committed Mar 17, 2023
1 parent 168b43f commit 1bae232
Show file tree
Hide file tree
Showing 14 changed files with 225 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Azure.AI.TextAnalytics.Tests.Infrastructure;
using Azure.Core.TestFramework;
using NUnit.Framework;

Expand Down Expand Up @@ -76,6 +77,7 @@ public AbstractSummaryTests(bool isAsync, TextAnalyticsClientOptions.ServiceVers
private const int AbstractiveSummarizationSentenceCount = 3;

[RecordedTest]
[RetryOnInternalServerError]
public async Task AbstractSummaryWithAADTest()
{
TextAnalyticsClient client = GetClient(useTokenCredential: true);
Expand All @@ -93,6 +95,7 @@ public async Task AbstractSummaryWithAADTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AbstractSummaryBatchWithErrorTest()
{
TextAnalyticsClient client = GetClient();
Expand All @@ -118,6 +121,7 @@ public async Task AbstractSummaryBatchWithErrorTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AbstractSummaryBatchConvenienceTest()
{
TextAnalyticsClient client = GetClient();
Expand All @@ -135,6 +139,7 @@ public async Task AbstractSummaryBatchConvenienceTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AbstractSummaryBatchConvenienceWithStatisticsTest()
{
TextAnalyticsClient client = GetClient();
Expand All @@ -158,6 +163,7 @@ public async Task AbstractSummaryBatchConvenienceWithStatisticsTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AbstractSummaryBatchTest()
{
TextAnalyticsClient client = GetClient();
Expand All @@ -175,6 +181,7 @@ public async Task AbstractSummaryBatchTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AbstractSummaryBatchWithStatisticsTest()
{
TextAnalyticsClient client = GetClient();
Expand All @@ -198,6 +205,7 @@ public async Task AbstractSummaryBatchWithStatisticsTest()
}

[RecordedTest]
[RetryOnInternalServerError]
[Ignore("https://github.com/Azure/azure-sdk-for-net/issues/32614")]
public async Task AbstractSummaryBatchConvenienceWithAutoDetectedLanguageTest()
{
Expand All @@ -216,6 +224,7 @@ public async Task AbstractSummaryBatchConvenienceWithAutoDetectedLanguageTest()
}

[RecordedTest]
[RetryOnInternalServerError]
[Ignore("https://github.com/Azure/azure-sdk-for-net/issues/32614")]
public async Task AnalyzeOperationAbstractSummaryWithAutoDetectedLanguageTest()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Azure.AI.TextAnalytics.Tests.Infrastructure;
using Azure.Core.TestFramework;
using NUnit.Framework;

Expand Down Expand Up @@ -60,6 +61,7 @@ public AnalyzeHealthcareEntitiesTests(bool isAsync, TextAnalyticsClientOptions.S
};

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesWithAADTest()
{
TextAnalyticsClient client = GetClient(useTokenCredential: true);
Expand All @@ -79,6 +81,7 @@ public async Task AnalyzeHealthcareEntitiesWithAADTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesTest()
{
TextAnalyticsClient client = GetClient();
Expand Down Expand Up @@ -142,6 +145,7 @@ public async Task AnalyzeHealthcareEntitiesTest()
}

[RecordedTest]
[RetryOnInternalServerError]
[ServiceVersion(Min = TextAnalyticsClientOptions.ServiceVersion.V2022_10_01_Preview)]
public async Task AnalyzeHealthcareEntitiesWithConfidenceScoreTest()
{
Expand All @@ -168,6 +172,7 @@ public async Task AnalyzeHealthcareEntitiesWithConfidenceScoreTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesTestWithAssertions()
{
TextAnalyticsClient client = GetClient();
Expand Down Expand Up @@ -233,6 +238,7 @@ public async Task AnalyzeHealthcareEntitiesTestWithAssertions()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesWithLanguageTest()
{
TextAnalyticsClient client = GetClient();
Expand All @@ -249,6 +255,7 @@ public async Task AnalyzeHealthcareEntitiesWithLanguageTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesBatchWithErrorTest()
{
TextAnalyticsClient client = GetClient();
Expand Down Expand Up @@ -279,6 +286,7 @@ public async Task AnalyzeHealthcareEntitiesBatchWithErrorTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesBatchConvenienceTest()
{
TextAnalyticsClient client = GetClient();
Expand All @@ -295,6 +303,7 @@ public async Task AnalyzeHealthcareEntitiesBatchConvenienceTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesBatchConvenienceWithStatisticsTest()
{
TextAnalyticsClient client = GetClient();
Expand All @@ -319,6 +328,7 @@ public async Task AnalyzeHealthcareEntitiesBatchConvenienceWithStatisticsTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesBatchTest()
{
TextAnalyticsClient client = GetClient();
Expand All @@ -342,6 +352,7 @@ public async Task AnalyzeHealthcareEntitiesBatchTest()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesBatchWithStatisticsTest()
{
TextAnalyticsClient client = GetClient();
Expand Down Expand Up @@ -373,6 +384,7 @@ public async Task AnalyzeHealthcareEntitiesBatchWithStatisticsTest()
}

[RecordedTest]
[RetryOnInternalServerError]
[ServiceVersion(Min = TextAnalyticsClientOptions.ServiceVersion.V2022_05_01)]
public async Task AnalyzeHealthcareEntitiesBatchWithNameTest()
{
Expand Down Expand Up @@ -401,6 +413,7 @@ public async Task AnalyzeHealthcareEntitiesBatchWithNameTest()
}

[RecordedTest]
[RetryOnInternalServerError]
[ServiceVersion(Max = TextAnalyticsClientOptions.ServiceVersion.V3_1)]
public void AnalyzeHealthcareEntitiesBatchWithNameThrows()
{
Expand All @@ -417,6 +430,7 @@ public void AnalyzeHealthcareEntitiesBatchWithNameThrows()
}

[RecordedTest]
[RetryOnInternalServerError]
public async Task AnalyzeHealthcareEntitiesPagination()
{
TextAnalyticsClient client = GetClient();
Expand Down Expand Up @@ -454,6 +468,7 @@ public async Task AnalyzeHealthcareEntitiesPagination()
}

[RecordedTest]
[RetryOnInternalServerError]
[ServiceVersion(Min = TextAnalyticsClientOptions.ServiceVersion.V2022_10_01_Preview)]
public async Task AnalyzeHealthcareEntitiesBatchWithFhirVersionTest()
{
Expand Down Expand Up @@ -481,6 +496,7 @@ public async Task AnalyzeHealthcareEntitiesBatchWithFhirVersionTest()
}

[RecordedTest]
[RetryOnInternalServerError]
[ServiceVersion(Max = TextAnalyticsClientOptions.ServiceVersion.V2022_05_01)]
public void AnalyzeHealthcareEntitiesBatchWithFhirVersionThrows()
{
Expand All @@ -497,6 +513,7 @@ public void AnalyzeHealthcareEntitiesBatchWithFhirVersionThrows()
}

[RecordedTest]
[RetryOnInternalServerError]
[ServiceVersion(Max = TextAnalyticsClientOptions.ServiceVersion.V2022_05_01)]
public void AnalyzeHealthcareEntitiesBatchWithDocumentTypeThrows()
{
Expand All @@ -513,6 +530,7 @@ public void AnalyzeHealthcareEntitiesBatchWithDocumentTypeThrows()
}

[RecordedTest]
[RetryOnInternalServerError]
[ServiceVersion(Min = TextAnalyticsClientOptions.ServiceVersion.V2022_10_01_Preview)]
public async Task AnalyzeHealthcareEntitiesBatchConvenienceWithAutoDetectedLanguageTest()
{
Expand All @@ -529,6 +547,7 @@ public async Task AnalyzeHealthcareEntitiesBatchConvenienceWithAutoDetectedLangu
}

[RecordedTest]
[RetryOnInternalServerError]
[ServiceVersion(Min = TextAnalyticsClientOptions.ServiceVersion.V2022_10_01_Preview)]
public async Task AnalyzeOperationAnalyzeHealthcareEntitiesWithAutoDetectedLanguageTest()
{
Expand Down
Loading

0 comments on commit 1bae232

Please sign in to comment.