Skip to content

Commit b2cdac7

Browse files
authored
[Text Analytics] Fix flaky tests (Azure#16784)
* fix flaky tests * update pagination test * cleanup Co-authored-by: Suhas Mehta <suhas.mehta@microsoft.com>
1 parent c3f69eb commit b2cdac7

25 files changed

+1167
-4586
lines changed

sdk/textanalytics/Azure.AI.TextAnalytics/src/TextAnalyticsClient.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,6 @@ private Response<RecognizeLinkedEntitiesResultCollection> RecognizeLinkedEntitie
20842084
/// <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support"/>.
20852085
/// For document length limits, maximum batch size, and supported text encoding, see
20862086
/// <a href="https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits"/>.
2087-
/// Use <see cref="GetHealthcareEntities(HealthcareOperation, CancellationToken)"/> for documents greater than 20.
20882087
/// </summary>
20892088
/// <param name="document">The document to analyze.</param>
20902089
/// <param name="language">The language that the document is written in.</param>
@@ -2130,7 +2129,6 @@ public virtual async Task<HealthcareOperation> StartHealthcareAsync(string docum
21302129
/// <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support"/>.
21312130
/// For document length limits, maximum batch size, and supported text encoding, see
21322131
/// <a href="https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits"/>.
2133-
/// Use <see cref="GetHealthcareEntities(HealthcareOperation, CancellationToken)"/> for documents greater than 20.
21342132
/// </summary>
21352133
/// <param name="document">The document to analyze.</param>
21362134
/// <param name="language">The language that the document is written in.</param>
@@ -2175,7 +2173,6 @@ public virtual HealthcareOperation StartHealthcare(string document, string langu
21752173
/// <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support"/>.
21762174
/// For document length limits, maximum batch size, and supported text encoding, see
21772175
/// <a href="https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits"/>.
2178-
/// Use <see cref="GetHealthcareEntities(HealthcareOperation, CancellationToken)"/> for documents greater than 20.
21792176
/// </summary>
21802177
/// <param name="documents">The documents to analyze.</param>
21812178
/// <param name="language">The language that the document is written in.</param>
@@ -2201,7 +2198,6 @@ public virtual async Task<HealthcareOperation> StartHealthcareBatchAsync(IEnumer
22012198
/// <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support"/>.
22022199
/// For document length limits, maximum batch size, and supported text encoding, see
22032200
/// <a href="https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits"/>.
2204-
/// Use <see cref="GetHealthcareEntities(HealthcareOperation, CancellationToken)"/> for documents greater than 20.
22052201
/// </summary>
22062202
/// <param name="documents">The documents to analyze.</param>
22072203
/// <param name="language">The language that the document is written in.
@@ -2234,7 +2230,6 @@ public virtual HealthcareOperation StartHealthcareBatch(IEnumerable<string> docu
22342230
/// <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support"/>.
22352231
/// For document length limits, maximum batch size, and supported text encoding, see
22362232
/// <a href="https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits"/>.
2237-
/// Use <see cref="GetHealthcareEntities(HealthcareOperation, CancellationToken)"/> for documents greater than 20.
22382233
/// </summary>
22392234
/// <param name="documents">The documents to analyze.</param>
22402235
/// <param name="options">The additional configurable options<see cref="HealthcareOptions"/></param>
@@ -2260,7 +2255,6 @@ public virtual HealthcareOperation StartHealthcareBatch(IEnumerable<TextDocument
22602255
/// <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support"/>.
22612256
/// For document length limits, maximum batch size, and supported text encoding, see
22622257
/// <a href="https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits"/>.
2263-
/// Use <see cref="GetHealthcareEntities(HealthcareOperation, CancellationToken)"/> for documents greater than 20.
22642258
/// </summary>
22652259
/// <param name="documents">The documents to analyze.</param>
22662260
/// <param name="options">The additional configurable options<see cref="HealthcareOptions"/></param>
@@ -2375,8 +2369,6 @@ public virtual string StartCancelHealthJob(HealthcareOperation operation, Cancel
23752369

23762370
/// <summary>
23772371
/// Gets collection of healthcare entities from the HealthOperation using async pageable.
2378-
/// This method is used if the number of documents are greater than 20
2379-
/// Otherwise, use the StartHealthcareAsync and StartHealthcareBatchAsync for less than 20 documents.
23802372
/// </summary>
23812373
/// <param name="operation"> Healthcare operation class object which is returned when operation is started. <see cref="HealthcareOperation"/></param>
23822374
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>

sdk/textanalytics/Azure.AI.TextAnalytics/tests/RecognizeHealthcareEntitiesTests.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,17 @@ public async Task RecognizeHealthcareEntitiesBatchWithPagination()
270270

271271
var list = new List<string>();
272272

273-
for (int i = 0; i < 23; i++)
273+
for (int i = 0; i < 10; i++)
274274
{
275275
list.Add(document);
276276
};
277277

278-
HealthcareOperation healthOperation = await client.StartHealthcareBatchAsync(list);
278+
HealthcareOptions options = new HealthcareOptions()
279+
{
280+
Top = 2
281+
};
282+
283+
HealthcareOperation healthOperation = await client.StartHealthcareBatchAsync(list, "en", options);
279284

280285
AsyncPageable<DocumentHealthcareResult> results = client.GetHealthcareEntities(healthOperation);
281286

@@ -285,7 +290,7 @@ public async Task RecognizeHealthcareEntitiesBatchWithPagination()
285290
resultCount += 1;
286291
}
287292

288-
Assert.AreEqual(23, resultCount);
293+
Assert.AreEqual(10, resultCount);
289294
}
290295
}
291296
}

sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/RecognizeHealthcareEntitiesTests/RecognizeHealthcareEntitiesBatchConvenienceTest.json

Lines changed: 24 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/textanalytics/Azure.AI.TextAnalytics/tests/SessionRecords/RecognizeHealthcareEntitiesTests/RecognizeHealthcareEntitiesBatchConvenienceTestAsync.json

Lines changed: 25 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)