Update to ADO 5ed9b2130da7f822153531489d802c28986f5d30

This commit is contained in:
Steve Faulkner
2020-05-26 13:53:41 -05:00
parent 36581fb6d9
commit 0494da4162
42 changed files with 1186 additions and 2242 deletions

View File

@@ -41,7 +41,7 @@ export class ArmApiVersions {
public static readonly arcadiaLivy: string = "2019-11-01-preview";
public static readonly arm: string = "2015-11-01";
public static readonly armFeatures: string = "2014-08-01-preview";
public static readonly publicVersion = "2020-03-01";
public static readonly publicVersion = "2020-04-01";
}
export class ArmResourceTypes {
@@ -334,11 +334,13 @@ export class HttpHeaders {
public static populateCollectionThroughputInfo = "x-ms-documentdb-populatecollectionthroughputinfo";
public static supportSpatialLegacyCoordinates = "x-ms-documentdb-supportspatiallegacycoordinates";
public static usePolygonsSmallerThanAHemisphere = "x-ms-documentdb-usepolygonssmallerthanahemisphere";
public static autoPilotThroughput = "ProvisionedThroughputSettings";
public static autoPilotThroughput = "autoscaleSettings";
public static autoPilotThroughputSDK = "x-ms-cosmos-offer-autopilot-settings";
public static autoPilotTier = "x-ms-cosmos-offer-autopilot-tier";
public static partitionKey: string = "x-ms-documentdb-partitionkey";
public static migrateOfferToManualThroughput: string = "x-ms-cosmos-migrate-offer-to-manual-throughput";
public static migrateOfferToAutopilot: string = "x-ms-cosmos-migrate-offer-to-autopilot";
public static mongoFixedCollectionWithSharedThroughput: string = "InsertSystemPartitionKey";
}
export class ApiType {

View File

@@ -544,7 +544,7 @@ export abstract class DataAccessUtilityBase {
const initialHeaders = request.autoPilot
? !hasAutoPilotV2FeatureFlag
? {
[Constants.HttpHeaders.autoPilotThroughput]: JSON.stringify({
[Constants.HttpHeaders.autoPilotThroughputSDK]: JSON.stringify({
maxThroughput: request.autoPilot.maxThroughput
})
}
@@ -654,7 +654,7 @@ export abstract class DataAccessUtilityBase {
const initialHeaders = autoPilot
? !hasAutoPilotV2FeatureFlag
? {
[Constants.HttpHeaders.autoPilotThroughput]: JSON.stringify({ maxThroughput: autoPilot.maxThroughput })
[Constants.HttpHeaders.autoPilotThroughputSDK]: JSON.stringify({ maxThroughput: autoPilot.maxThroughput })
}
: {
[Constants.HttpHeaders.autoPilotTier]: autoPilot.autopilotTier

View File

@@ -259,15 +259,19 @@ describe("MongoProxyClient", () => {
sid: "a2",
rg: "c1",
dba: "main",
is: false
is: false,
isFixedCollectionWithSharedThroughputBeingCreated: true
};
_createMongoCollectionWithARM("management.azure.com", properties, { "x-ms-cosmos-offer-autopilot-tier": "1" });
expect(
resourceProviderClientPutAsyncSpy
).toHaveBeenCalledWith(
expect(resourceProviderClientPutAsyncSpy).toHaveBeenCalledWith(
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/foo/mongodbDatabases/a1-db/collections/abc-collection",
"2020-03-01",
{ properties: { options: { "x-ms-cosmos-offer-autopilot-tier": "1" }, resource: { id: "abc-collection" } } }
"2020-04-01",
{
properties: {
options: { "x-ms-cosmos-offer-autopilot-tier": "1", InsertSystemPartitionKey: "true" },
resource: { id: "abc-collection" }
}
}
);
});
it("should create a collection with provisioned throughput when provisioned throughput is selected + shared throughput is false", () => {
@@ -282,15 +286,19 @@ describe("MongoProxyClient", () => {
rg: "c1",
dba: "main",
is: false,
offerThroughput: 400
offerThroughput: 400,
isFixedCollectionWithSharedThroughputBeingCreated: true
};
_createMongoCollectionWithARM("management.azure.com", properties, undefined);
expect(
resourceProviderClientPutAsyncSpy
).toHaveBeenCalledWith(
expect(resourceProviderClientPutAsyncSpy).toHaveBeenCalledWith(
"subscriptions/a2/resourceGroups/c1/providers/Microsoft.DocumentDB/databaseAccounts/foo/mongodbDatabases/a1-db/collections/abc-collection",
"2020-03-01",
{ properties: { options: { throughput: "400" }, resource: { id: "abc-collection" } } }
"2020-04-01",
{
properties: {
options: { throughput: "400", InsertSystemPartitionKey: "true" },
resource: { id: "abc-collection" }
}
}
);
});
});

View File

@@ -356,6 +356,7 @@ export function createMongoCollectionWithARM(
armEndpoint: string,
databaseId: string,
analyticalStorageTtl: number,
isFixedCollectionWithSharedThroughputBeingCreated: boolean,
collectionId: string,
offerThroughput: number,
shardKey: string,
@@ -379,7 +380,8 @@ export function createMongoCollectionWithARM(
sid: CosmosClient.subscriptionId(),
rg: CosmosClient.resourceGroup(),
dba: databaseAccount.name,
analyticalStorageTtl
analyticalStorageTtl,
isFixedCollectionWithSharedThroughputBeingCreated
};
if (createDatabase) {
@@ -451,6 +453,11 @@ export async function _createMongoCollectionWithARM(
}
}
if (params.isFixedCollectionWithSharedThroughputBeingCreated) {
rpPayloadToCreateCollection.properties.options[Constants.HttpHeaders.mongoFixedCollectionWithSharedThroughput] =
"true";
}
if (params.analyticalStorageTtl) {
rpPayloadToCreateCollection.properties.resource.analyticalStorageTtl = params.analyticalStorageTtl;
}