public async Task CreateDropFixedDatabase() { DatabaseCore database = (DatabaseInlineCore)await this.cosmosClient.CreateDatabaseAsync( nameof(CreateDropAutoscaleDatabase) + Guid.NewGuid().ToString(), ThroughputProperties.CreateFixedThroughput(5000)); ThroughputResponse fixedDatabaseThroughput = await database.ReadThroughputAsync(requestOptions : null); Assert.IsNotNull(fixedDatabaseThroughput); Assert.AreEqual(5000, fixedDatabaseThroughput.Resource.Throughput); Assert.IsNull(fixedDatabaseThroughput.Resource.MaxAutoscaleThroughput); Assert.IsNull(fixedDatabaseThroughput.Resource.AutoUpgradeMaxThroughputIncrementPercentage); ThroughputResponse fixedReplaced = await database.ReplaceThroughputAsync( ThroughputProperties.CreateFixedThroughput(6000)); Assert.IsNotNull(fixedReplaced); Assert.AreEqual(6000, fixedReplaced.Resource.Throughput); Assert.IsNull(fixedReplaced.Resource.MaxAutoscaleThroughput); Assert.IsNull(fixedReplaced.Resource.AutoUpgradeMaxThroughputIncrementPercentage); ThroughputResponse fixedReplacedIfExists = await database.ReplaceThroughputPropertiesIfExistsAsync( ThroughputProperties.CreateFixedThroughput(7000)); Assert.IsNotNull(fixedReplacedIfExists); Assert.AreEqual(7000, fixedReplacedIfExists.Resource.Throughput); Assert.IsNull(fixedReplacedIfExists.Resource.MaxAutoscaleThroughput); Assert.IsNull(fixedReplacedIfExists.Resource.AutoUpgradeMaxThroughputIncrementPercentage); await database.DeleteAsync(); }
public async Task CreateDropAutoscaleDatabaseStreamApi() { string databaseId = Guid.NewGuid().ToString(); using (ResponseMessage response = await this.cosmosClient.CreateDatabaseStreamAsync( new DatabaseProperties(databaseId), ThroughputProperties.CreateAutoscaleProvionedThroughput(5000))) { Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); } DatabaseCore database = (DatabaseInlineCore)this.cosmosClient.GetDatabase(databaseId); ThroughputResponse autoscale = await database.ReadThroughputAsync(requestOptions : null); Assert.IsNotNull(autoscale); Assert.AreEqual(5000, autoscale.Resource.MaxAutoscaleThroughput); ThroughputResponse autoscaleReplaced = await database.ReplaceThroughputAsync( ThroughputProperties.CreateAutoscaleProvionedThroughput(10000)); Assert.IsNotNull(autoscaleReplaced); Assert.AreEqual(10000, autoscaleReplaced.Resource.MaxAutoscaleThroughput); await database.DeleteAsync(); }
public async Task CreateDropAutoscaleAutoUpgradeDatabase() { DatabaseCore database = (DatabaseInlineCore)await this.cosmosClient.CreateDatabaseAsync( nameof(CreateDropAutoscaleAutoUpgradeDatabase) + Guid.NewGuid(), ThroughputProperties.CreateAutoscaleProvionedThroughput( maxAutoscaleThroughput: 5000, autoUpgradeMaxThroughputIncrementPercentage: 10)); // Container is required to validate database throughput upgrade scenarios Container container = await database.CreateContainerAsync("Test", "/id"); ThroughputResponse autoscale = await database.ReadThroughputAsync(requestOptions : null); Assert.IsNotNull(autoscale); Assert.AreEqual(5000, autoscale.Resource.MaxAutoscaleThroughput); Assert.AreEqual(10, autoscale.Resource.AutoUpgradeMaxThroughputIncrementPercentage); ThroughputResponse autoscaleReplaced = await database.ReplaceThroughputAsync( ThroughputProperties.CreateAutoscaleProvionedThroughput(6000)); Assert.IsNotNull(autoscaleReplaced); Assert.AreEqual(6000, autoscaleReplaced.Resource.MaxAutoscaleThroughput); Assert.IsNull(autoscaleReplaced.Resource.AutoUpgradeMaxThroughputIncrementPercentage); ThroughputResponse autoUpgradeReplace = await database.ReplaceThroughputAsync( ThroughputProperties.CreateAutoscaleProvionedThroughput( maxAutoscaleThroughput: 7000, autoUpgradeMaxThroughputIncrementPercentage: 20)); Assert.IsNotNull(autoUpgradeReplace); Assert.AreEqual(7000, autoUpgradeReplace.Resource.MaxAutoscaleThroughput); Assert.AreEqual(20, autoUpgradeReplace.Resource.AutoUpgradeMaxThroughputIncrementPercentage); await database.DeleteAsync(); }
public async Task CreateDropAutoscaleDatabase() { DatabaseCore database = (DatabaseInlineCore)await this.cosmosClient.CreateDatabaseAsync( nameof(CreateDropAutoscaleDatabase) + Guid.NewGuid().ToString(), ThroughputProperties.CreateAutoscaleProvionedThroughput(5000)); ThroughputResponse autoscale = await database.ReadThroughputAsync(requestOptions : null); Assert.IsNotNull(autoscale); Assert.AreEqual(5000, autoscale.Resource.MaxAutoscaleThroughput); ThroughputResponse autoscaleReplaced = await database.ReplaceThroughputAsync( ThroughputProperties.CreateAutoscaleProvionedThroughput(10000)); Assert.IsNotNull(autoscaleReplaced); Assert.AreEqual(10000, autoscaleReplaced.Resource.MaxAutoscaleThroughput); await database.DeleteAsync(); }