mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-28 21:32:05 +00:00
Latest test changes
This commit is contained in:
committed by
Craig Boger (from Dev Box)
parent
28a0015d3d
commit
f42d80cd2b
@@ -132,6 +132,10 @@ let _client: Cosmos.CosmosClient;
|
||||
export function client(): Cosmos.CosmosClient {
|
||||
if (_client) return _client;
|
||||
|
||||
// if (_client) {
|
||||
// _client.dispose();
|
||||
// }
|
||||
|
||||
let _defaultHeaders: Cosmos.CosmosHeaders = {};
|
||||
_defaultHeaders["x-ms-cosmos-sdk-supportedcapabilities"] =
|
||||
SDKSupportedCapabilities.None | SDKSupportedCapabilities.PartitionMerge;
|
||||
@@ -192,7 +196,6 @@ export function client(): Cosmos.CosmosClient {
|
||||
console.log(`Current parsed write endpoint: ${JSON.stringify(parsedWriteEndpoint)}`);
|
||||
// const writeHostAddress = await findHostAddress(parsedWriteEndpoint);
|
||||
// console.log(`Current write host address: ${JSON.stringify(writeHostAddress)}`);
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error getting read endpoints:", error);
|
||||
}
|
||||
@@ -208,7 +211,10 @@ export function client(): Cosmos.CosmosClient {
|
||||
tokenProvider,
|
||||
connectionPolicy: {
|
||||
enableEndpointDiscovery: true,
|
||||
// preferredLocations: ["East US", "West US", "East US 2"],
|
||||
preferredLocations: ["East US", "Central US"],
|
||||
connectionMode: Cosmos.ConnectionMode.Gateway,
|
||||
enableBackgroundEndpointRefreshing: true,
|
||||
endpointRefreshRateInMs: 5000,
|
||||
},
|
||||
userAgentSuffix: "Azure Portal",
|
||||
defaultHeaders: _defaultHeaders,
|
||||
|
||||
@@ -35,6 +35,8 @@ export async function readCollectionInternal(
|
||||
try {
|
||||
const response = await cosmosClient.database(databaseId).container(collectionId).read();
|
||||
collection = response.resource as DataModels.Collection;
|
||||
const currentReadRegions = await cosmosClient.getReadEndpoint();
|
||||
console.log(`Current account endpoints - readCollection: ${JSON.stringify(currentReadRegions)}`);
|
||||
} catch (error) {
|
||||
handleError(error, "ReadCollection", `Error while querying container ${collectionId}`);
|
||||
throw error;
|
||||
|
||||
@@ -47,7 +47,8 @@ export async function readDatabases(): Promise<DataModels.Database[]> {
|
||||
clearMessage();
|
||||
return databases;
|
||||
}
|
||||
|
||||
const currentReadRegion = await client().getReadEndpoint();
|
||||
console.log(`Current account endpoints - readDatabases: ${JSON.stringify(currentReadRegion)}`);
|
||||
try {
|
||||
if (
|
||||
userContext.authType === AuthType.AAD &&
|
||||
|
||||
@@ -25,6 +25,11 @@ export const readDocument = async (collection: CollectionBase, documentId: Docum
|
||||
.item(documentId.id(), getPartitionKeyValue(documentId))
|
||||
.read(options);
|
||||
|
||||
const currentReadRegion = await client().getReadEndpoint();
|
||||
console.log(`Current account endpoints - readDocument: ${JSON.stringify(currentReadRegion)}`);
|
||||
|
||||
console.log(response.diagnostics);
|
||||
|
||||
return response?.resource;
|
||||
} catch (error) {
|
||||
handleError(error, "ReadDocument", `Failed to read ${entityName} ${documentId.id()}`);
|
||||
|
||||
Reference in New Issue
Block a user