Skip to content

Commit f3f1c6a

Browse files
authored
[DocumentIntelligence] Enabling live testing (#43455)
1 parent 151e662 commit f3f1c6a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

sdk/documentintelligence/Azure.AI.DocumentIntelligence/tests/Infrastructure/DocumentIntelligenceTestEnvironment.cs

+19
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.IO;
66
using System.Reflection;
7+
using System.Threading.Tasks;
78
using Azure.Core.TestFramework;
89

910
namespace Azure.AI.DocumentIntelligence.Tests
@@ -51,5 +52,23 @@ public static BinaryData CreateBinaryData(string filename)
5152

5253
return BinaryData.FromBytes(bytes);
5354
}
55+
56+
protected override async ValueTask<bool> IsEnvironmentReadyAsync()
57+
{
58+
var endpoint = new Uri(Endpoint);
59+
var keyCredential = new AzureKeyCredential(ApiKey);
60+
var keyCredentialClient = new DocumentIntelligenceAdministrationClient(endpoint, keyCredential);
61+
62+
try
63+
{
64+
await keyCredentialClient.GetResourceInfoAsync();
65+
}
66+
catch (RequestFailedException e) when (e.Status == 401)
67+
{
68+
return false;
69+
}
70+
71+
return true;
72+
}
5473
}
5574
}

sdk/documentintelligence/tests.yml

+4
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ extends:
44
template: ../../eng/pipelines/templates/stages/archetype-sdk-tests.yml
55
parameters:
66
ServiceDirectory: documentintelligence
7+
CloudConfig:
8+
Public:
9+
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
10+
Location: 'eastus'
711
SupportedClouds: 'Public'

0 commit comments

Comments
 (0)