mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-12 15:37:27 +01: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 {
|
export function client(): Cosmos.CosmosClient {
|
||||||
if (_client) return _client;
|
if (_client) return _client;
|
||||||
|
|
||||||
|
// if (_client) {
|
||||||
|
// _client.dispose();
|
||||||
|
// }
|
||||||
|
|
||||||
let _defaultHeaders: Cosmos.CosmosHeaders = {};
|
let _defaultHeaders: Cosmos.CosmosHeaders = {};
|
||||||
_defaultHeaders["x-ms-cosmos-sdk-supportedcapabilities"] =
|
_defaultHeaders["x-ms-cosmos-sdk-supportedcapabilities"] =
|
||||||
SDKSupportedCapabilities.None | SDKSupportedCapabilities.PartitionMerge;
|
SDKSupportedCapabilities.None | SDKSupportedCapabilities.PartitionMerge;
|
||||||
@@ -192,7 +196,6 @@ export function client(): Cosmos.CosmosClient {
|
|||||||
console.log(`Current parsed write endpoint: ${JSON.stringify(parsedWriteEndpoint)}`);
|
console.log(`Current parsed write endpoint: ${JSON.stringify(parsedWriteEndpoint)}`);
|
||||||
// const writeHostAddress = await findHostAddress(parsedWriteEndpoint);
|
// const writeHostAddress = await findHostAddress(parsedWriteEndpoint);
|
||||||
// console.log(`Current write host address: ${JSON.stringify(writeHostAddress)}`);
|
// console.log(`Current write host address: ${JSON.stringify(writeHostAddress)}`);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error getting read endpoints:", error);
|
console.error("Error getting read endpoints:", error);
|
||||||
}
|
}
|
||||||
@@ -208,7 +211,10 @@ export function client(): Cosmos.CosmosClient {
|
|||||||
tokenProvider,
|
tokenProvider,
|
||||||
connectionPolicy: {
|
connectionPolicy: {
|
||||||
enableEndpointDiscovery: true,
|
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",
|
userAgentSuffix: "Azure Portal",
|
||||||
defaultHeaders: _defaultHeaders,
|
defaultHeaders: _defaultHeaders,
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ export async function readCollectionInternal(
|
|||||||
try {
|
try {
|
||||||
const response = await cosmosClient.database(databaseId).container(collectionId).read();
|
const response = await cosmosClient.database(databaseId).container(collectionId).read();
|
||||||
collection = response.resource as DataModels.Collection;
|
collection = response.resource as DataModels.Collection;
|
||||||
|
const currentReadRegions = await cosmosClient.getReadEndpoint();
|
||||||
|
console.log(`Current account endpoints - readCollection: ${JSON.stringify(currentReadRegions)}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, "ReadCollection", `Error while querying container ${collectionId}`);
|
handleError(error, "ReadCollection", `Error while querying container ${collectionId}`);
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ export async function readDatabases(): Promise<DataModels.Database[]> {
|
|||||||
clearMessage();
|
clearMessage();
|
||||||
return databases;
|
return databases;
|
||||||
}
|
}
|
||||||
|
const currentReadRegion = await client().getReadEndpoint();
|
||||||
|
console.log(`Current account endpoints - readDatabases: ${JSON.stringify(currentReadRegion)}`);
|
||||||
try {
|
try {
|
||||||
if (
|
if (
|
||||||
userContext.authType === AuthType.AAD &&
|
userContext.authType === AuthType.AAD &&
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ export const readDocument = async (collection: CollectionBase, documentId: Docum
|
|||||||
.item(documentId.id(), getPartitionKeyValue(documentId))
|
.item(documentId.id(), getPartitionKeyValue(documentId))
|
||||||
.read(options);
|
.read(options);
|
||||||
|
|
||||||
|
const currentReadRegion = await client().getReadEndpoint();
|
||||||
|
console.log(`Current account endpoints - readDocument: ${JSON.stringify(currentReadRegion)}`);
|
||||||
|
|
||||||
|
console.log(response.diagnostics);
|
||||||
|
|
||||||
return response?.resource;
|
return response?.resource;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, "ReadDocument", `Failed to read ${entityName} ${documentId.id()}`);
|
handleError(error, "ReadDocument", `Failed to read ${entityName} ${documentId.id()}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user