public async Task ReadAutoscaleWithFixedTests() { Database database = await this.cosmosClient.CreateDatabaseAsync( Guid.NewGuid().ToString()); ContainerInternal fixedContainer = (ContainerInlineCore)await database.CreateContainerAsync( new ContainerProperties(Guid.NewGuid().ToString(), "/pk"), throughput : 1000); Assert.IsNotNull(fixedContainer); int?throughput = await fixedContainer.ReadThroughputAsync(); Assert.AreEqual(1000, throughput); // Reading a fixed container with autoscale results in max throughput being null ThroughputResponse autoscale = await fixedContainer.ReadThroughputAsync(requestOptions : null); Assert.IsNotNull(autoscale); Assert.IsNotNull(autoscale.Resource.Throughput); Assert.AreEqual(1000, autoscale.Resource.Throughput); Assert.IsNull(autoscale.Resource.AutoscaleMaxThroughput); await database.DeleteAsync(); }
[TestCategory("Quarantine")] // Not currently working with emulator public async Task CreateDropAutoscaleContainer() { DatabaseInternal database = (DatabaseInlineCore)await this.cosmosClient.CreateDatabaseAsync( Guid.NewGuid().ToString()); ContainerInternal container = (ContainerInlineCore)await database.CreateContainerAsync( new ContainerProperties(Guid.NewGuid().ToString(), "/pk"), ThroughputProperties.CreateAutoscaleThroughput(5000)); Assert.IsNotNull(container); ThroughputResponse throughputResponse = await container.ReadThroughputAsync(requestOptions : null); Assert.IsNotNull(throughputResponse); Assert.AreEqual(5000, throughputResponse.Resource.AutoscaleMaxThroughput); throughputResponse = await container.ReplaceThroughputAsync( ThroughputProperties.CreateAutoscaleThroughput(6000), requestOptions : null, cancellationToken : default(CancellationToken)); Assert.IsNotNull(throughputResponse); Assert.AreEqual(6000, throughputResponse.Resource.AutoscaleMaxThroughput); await database.DeleteAsync(); }
[TestCategory("Quarantine")] // Not currently working with emulator public async Task ReadFixedWithAutoscaleTests() { DatabaseInternal database = (DatabaseInlineCore)await this.cosmosClient.CreateDatabaseAsync( Guid.NewGuid().ToString()); ContainerInternal autoscaleContainer = (ContainerInlineCore)await database.CreateContainerAsync( new ContainerProperties(Guid.NewGuid().ToString(), "/pk"), ThroughputProperties.CreateAutoscaleThroughput(5000)); Assert.IsNotNull(autoscaleContainer); // Reading a autoscale container with fixed results int?throughput = await autoscaleContainer.ReadThroughputAsync(); Assert.IsNotNull(throughput); await database.DeleteAsync(); }