Skip to content

Commit 2841afb

Browse files
committed
fix emulator test.
1 parent b08f0ee commit 2841afb

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemThinClientTests.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests
1313
using System.Text.Json;
1414
using System.Text.Json.Serialization;
1515
using System.Threading.Tasks;
16+
using global::Azure;
1617
using global::Azure.Core;
1718
using Microsoft.Azure.Cosmos.Fluent;
1819
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -243,12 +244,9 @@ public async Task CreateItemsTest()
243244
public async Task CreateItemsTestWithThinClientFlagEnabledAndAccountDisabled()
244245
{
245246
Environment.SetEnvironmentVariable(ConfigurationManager.ThinClientModeEnabled, "True");
246-
string connectionString = ConfigurationManager.GetEnvironmentVariable<string>("COSMOSDB_ACCOUNT_CONNECTION_STRING", null);
247-
248-
if (string.IsNullOrEmpty(connectionString))
249-
{
250-
Assert.Fail("Set environment variable COSMOSDB_MULTI_REGION to run the tests");
251-
}
247+
string authKey = Utils.ConfigurationManager.AppSettings["MasterKey"];
248+
string endpoint = Utils.ConfigurationManager.AppSettings["GatewayEndpoint"];
249+
AzureKeyCredential masterKeyCredential = new AzureKeyCredential(authKey);
252250

253251
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions
254252
{
@@ -259,7 +257,8 @@ public async Task CreateItemsTestWithThinClientFlagEnabledAndAccountDisabled()
259257
this.cosmosSystemTextJsonSerializer = new MultiRegionSetupHelpers.CosmosSystemTextJsonSerializer(jsonSerializerOptions);
260258

261259
this.client = new CosmosClient(
262-
connectionString,
260+
endpoint,
261+
masterKeyCredential,
263262
new CosmosClientOptions()
264263
{
265264
ConnectionMode = ConnectionMode.Gateway,

0 commit comments

Comments
 (0)