Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,12 @@ public void TestCassandraOperationsCmdletsUsingInputObject()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CassandraOperationsCmdletsUsingInputObject");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCassandraThroughputCmdlets()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CassandraThroughputCmdlets");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,57 @@ function Test-CassandraOperationsCmdletsUsingInputObject

$IsKeyspaceRemoved = Remove-AzCosmosDBCassandraKeyspace -InputObject $NewKeyspace -PassThru
Assert-AreEqual $IsKeyspaceRemoved true
}

function Test-CassandraThroughputCmdlets
{
$AccountName = "db2725"
$rgName = "CosmosDBResourceGroup2510"
$KeyspaceName = "KeyspaceName"
$TableName = "tableName"

$Column1 = New-AzCosmosDBCassandraColumn -Name "ColumnA" -Type "int"
$Column2 = New-AzCosmosDBCassandraColumn -Name "ColumnB" -Type "ascii"
$clusterkey1 = New-AzCosmosDBCassandraClusterKey -Name "ColumnB" -OrderBy "Asc"
$schema = New-AzCosmosDBCassandraSchema -Column $Column1,$Column2 -ClusterKey $clusterkey1 -PartitionKey "ColumnA"

$ThroughputValue = 1200
$UpdatedThroughputValue = 1100
$UpdatedThroughputValue2 = 1000
$UpdatedThroughputValue3 = 900

$TableThroughputValue = 800
$UpdatedTableThroughputValue = 700
$UpdatedTableThroughputValue2 = 600
$UpdatedTableThroughputValue3 = 500

$NewKeyspace = Set-AzCosmosDBCassandraKeyspace -AccountName $AccountName -ResourceGroupName $rgName -Name $KeyspaceName -Throughput $ThroughputValue
$Throughput = Get-AzCosmosDBCassandraKeyspaceThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $KeyspaceName
Assert-AreEqual $Throughput.Throughput $ThroughputValue

$UpdatedThroughput = Update-AzCosmosDBCassandraKeyspaceThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $KeyspaceName -Throughput $UpdatedThroughputValue
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue

$CosmosDBAccount = Get-AzCosmosDBAccount -ResourceGroupName $rgName -Name $AccountName
$UpdatedThroughput = Update-AzCosmosDBCassandraKeyspaceThroughput -ParentObject $CosmosDBAccount -Name $KeyspaceName -Throughput $UpdatedThroughputValue2
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue2

$UpdatedThroughput = Update-AzCosmosDBCassandraKeyspaceThroughput -InputObject $NewKeyspace -Throughput $UpdatedThroughputValue3
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue3

$NewTable = Set-AzCosmosDBCassandraTable -AccountName $AccountName -ResourceGroupName $rgName -KeyspaceName $KeyspaceName -Name $TableName -Schema $schema -Throughput $TableThroughputValue
$TableThroughput = Get-AzCosmosDBCassandraTableThroughput -AccountName $AccountName -ResourceGroupName $rgName -KeyspaceName $KeyspaceName -Name $TableName
Assert-AreEqual $TableThroughput.Throughput $TableThroughputValue

$UpdatedTableThroughput = Update-AzCosmosDBCassandraTableThroughput -InputObject $NewTable -Throughput $UpdatedTableThroughputValue
Assert-AreEqual $UpdatedTableThroughput.Throughput $UpdatedTableThroughputValue

$UpdatedTableThroughput = Update-AzCosmosDBCassandraTableThroughput -ParentObject $NewKeyspace -Name $TableName -Throughput $UpdatedTableThroughputValue2
Assert-AreEqual $UpdatedTableThroughput.Throughput $UpdatedTableThroughputValue2

$UpdatedTableThroughput = Update-AzCosmosDBCassandraTableThroughput -AccountName $AccountName -ResourceGroupName $rgName -KeyspaceName $KeyspaceName -Name $TableName -Throughput $UpdatedTableThroughputValue3
Assert-AreEqual $UpdatedTableThroughput.Throughput $UpdatedTableThroughputValue3

Remove-AzCosmosDBCassandraTable -InputObject $NewTable
Remove-AzCosmosDBCassandraKeyspace -InputObject $NewKeyspace
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,12 @@ public void TestGremlinOperationsCmdletsUsingInputObject()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GremlinOperationsCmdletsUsingInputObject");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGremlinThroughputCmdlets()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GremlinThroughputCmdlets");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,55 @@ function Test-GremlinOperationsCmdletsUsingInputObject

$IsDatabaseRemoved = Remove-AzCosmosDBGremlinDatabase -InputObject $NewDatabase -PassThru
Assert-AreEqual $IsDatabaseRemoved true
}

function Test-GremlinThroughputCmdlets
{
$AccountName = "db1002"
$rgName = "CosmosDBResourceGroup2510"
$DatabaseName = "dbName3"
$GraphName = "graphName"

$PartitionKeyPathValue = "/foo"
$PartitionKeyKindValue = "Hash"

$ThroughputValue = 1200
$UpdatedThroughputValue = 1100
$UpdatedThroughputValue2 = 1000
$UpdatedThroughputValue3 = 900

$GraphThroughputValue = 800
$UpdatedGraphThroughputValue = 700
$UpdatedGraphThroughputValue2 = 600
$UpdatedGraphThroughputValue3 = 500

$NewDatabase = Set-AzCosmosDBGremlinDatabase -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName -Throughput $ThroughputValue
$Throughput = Get-AzCosmosDBGremlinDatabaseThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName
Assert-AreEqual $Throughput.Throughput $ThroughputValue

$UpdatedThroughput = Update-AzCosmosDBGremlinDatabaseThroughput -InputObject $NewDatabase -Throughput $UpdatedThroughputValue
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue

$UpdatedThroughput = Update-AzCosmosDBGremlinDatabaseThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName -Throughput $UpdatedThroughputValue2
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue2

$CosmosDBAccount = Get-AzCosmosDBAccount -ResourceGroupName $rgName -Name $AccountName
$UpdatedThroughput = Update-AzCosmosDBGremlinDatabaseThroughput -ParentObject $CosmosDBAccount -Name $DatabaseName -Throughput $UpdatedThroughputValue3
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue3

$NewGraph = Set-AzCosmosDBGremlinGraph -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -Throughput $GraphThroughputValue -Name $GraphName -PartitionKeyPath $PartitionKeyPathValue -PartitionKeyKind $PartitionKeyKindValue
$GraphThroughput = Get-AzCosmosDBGremlinGraphThroughput -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -Name $GraphName
Assert-AreEqual $GraphThroughput.Throughput $GraphThroughputValue

$UpdatedGraphThroughput = Update-AzCosmosDBGremlinGraphThroughput -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -Name $GraphName -Throughput $UpdatedGraphThroughputValue
Assert-AreEqual $UpdatedGraphThroughput.Throughput $UpdatedGraphThroughputValue

$UpdatedGraphThroughput = Update-AzCosmosDBGremlinGraphThroughput -InputObject $NewGraph -Throughput $UpdatedGraphThroughputValue2
Assert-AreEqual $UpdatedGraphThroughput.Throughput $UpdatedGraphThroughputValue2

$UpdatedGraphThroughput = Update-AzCosmosDBGremlinGraphThroughput -ParentObject $NewDatabase -Name $GraphName -Throughput $UpdatedGraphThroughputValue3
Assert-AreEqual $UpdatedGraphThroughput.Throughput $UpdatedGraphThroughputValue3

Remove-AzCosmosDBGremlinGraph -InputObject $NewGraph
Remove-AzCosmosDBGremlinDatabase -InputObject $NewDatabase
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,12 @@ public void TestMongoOperationsCmdletsUsingInputObject()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-MongoOperationsCmdletsUsingInputObject");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestMongoThroughputCmdlets()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-MongoThroughputCmdlets");
}
}
}
50 changes: 50 additions & 0 deletions src/CosmosDB/CosmosDB.Test/ScenarioTests/MongoOperationsTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,54 @@ function Test-MongoOperationsCmdletsUsingInputObject

$IsDatabaseRemoved = Remove-AzCosmosDBMongoDBDatabase -InputObject $NewDatabase -PassThru
Assert-AreEqual $IsDatabaseRemoved true
}

function Test-MongoThroughputCmdlets
{
$AccountName = "db001"
$rgName = "CosmosDBResourceGroup3668"
$DatabaseName = "dbName3"
$CollectionName = "collectionName"

$ThroughputValue = 1200
$UpdatedThroughputValue = 1100
$UpdatedThroughputValue2 = 1000
$UpdatedThroughputValue3 = 900

$CollectionThroughputValue = 800
$UpdatedCollectionThroughputValue = 700
$UpdatedCollectionThroughputValue2 = 600
$UpdatedCollectionThroughputValue3 = 500

$ShardKey = "shardKeyPath"

$NewDatabase = Set-AzCosmosDBMongoDBDatabase -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName -Throughput $ThroughputValue
$Throughput = Get-AzCosmosDBMongoDBDatabaseThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName
Assert-AreEqual $Throughput.Throughput $ThroughputValue

$UpdatedThroughput = Update-AzCosmosDBMongoDBDatabaseThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName -Throughput $UpdatedThroughputValue
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue

$CosmosDBAccount = Get-AzCosmosDBAccount -ResourceGroupName $rgName -Name $AccountName
$UpdatedThroughput = Update-AzCosmosDBMongoDBDatabaseThroughput -ParentObject $CosmosDBAccount -Name $DatabaseName -Throughput $UpdatedThroughputValue2
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue2

$UpdatedThroughput = Update-AzCosmosDBMongoDBDatabaseThroughput -InputObject $NewDatabase -Throughput $UpdatedThroughputValue3
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue3

$NewCollection = Set-AzCosmosDBMongoDBCollection -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -Throughput $CollectionThroughputValue -Name $CollectionName -Shard $ShardKey
$CollectionThroughput = Get-AzCosmosDBMongoDBCollectionThroughput -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -Name $CollectionName
Assert-AreEqual $CollectionThroughput.Throughput $CollectionThroughputValue

$UpdatedCollectionThroughput = Update-AzCosmosDBMongoDBCollectionThroughput -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -Name $CollectionName -Throughput $UpdatedCollectionThroughputValue
Assert-AreEqual $UpdatedCollectionThroughput.Throughput $UpdatedCollectionThroughputValue

$UpdatedCollectionThroughput = Update-AzCosmosDBMongoDBCollectionThroughput -InputObject $NewCollection -Throughput $UpdatedCollectionThroughputValue2
Assert-AreEqual $UpdatedCollectionThroughput.Throughput $UpdatedCollectionThroughputValue2

$UpdatedCollectionThroughput = Update-AzCosmosDBMongoDBCollectionThroughput -ParentObject $NewDatabase -Name $CollectionName -Throughput $UpdatedCollectionThroughputValue3
Assert-AreEqual $UpdatedCollectionThroughput.Throughput $UpdatedCollectionThroughputValue3

Remove-AzCosmosDBMongoDBCollection -InputObject $NewCollection
Remove-AzCosmosDBMongoDBDatabase -InputObject $NewDatabase
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,12 @@ public void TestSqlOperationsCmdletsUsingInputObject()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SqlOperationsCmdletsUsingInputObject");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSqlThroughputCmdlets()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SqlThroughputCmdlets");
}
}
}
56 changes: 52 additions & 4 deletions src/CosmosDB/CosmosDB.Test/ScenarioTests/SqlOperationsTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,11 @@ function Test-SqlOperationsCmdletsUsingInputObject

$PartitionKeyPathValue = "/foo/bar"
$PartitionKeyKindValue = "Hash"
$StoredProcedureName = "storedProcedure"

$StoredProcedureName = "storedProcedure"
$UDFName = "udf"
$TriggerName = "trigger"

$PartitionKeyPathValue = "/foo/bar"
$PartitionKeyKindValue = "Hash"

$Body = "function () { var context = getContext(); " +
"var response = context.getResponse();" +
"response.setBody('Hello, World');" +
Expand Down Expand Up @@ -250,5 +247,56 @@ function Test-SqlOperationsCmdletsUsingInputObject

Remove-AzCosmosDBSqlContainer -InputObject $NewContainer

Remove-AzCosmosDBSqlDatabase -InputObject $NewDatabase
}

function Test-SqlThroughputCmdlets
{
$AccountName = "cosmosdb9921232812"
$rgName = "rgtest9921232812"
$DatabaseName = "dbName3"
$ContainerName = "containerName"

$PartitionKeyPathValue = "/foo/bar"
$PartitionKeyKindValue = "Hash"

$ThroughputValue = 1200
$UpdatedThroughputValue = 1100
$UpdatedThroughputValue2 = 1000
$UpdatedThroughputValue3 = 900

$ContainerThroughputValue = 800
$UpdatedContainerThroughputValue = 700
$UpdatedContainerThroughputValue2 = 600
$UpdatedContainerThroughputValue3 = 500

$NewDatabase = Set-AzCosmosDBSqlDatabase -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName -Throughput $ThroughputValue
$Throughput = Get-AzCosmosDBSqlDatabaseThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName
Assert-AreEqual $Throughput.Throughput $ThroughputValue

$UpdatedThroughput = Update-AzCosmosDBSqlDatabaseThroughput -InputObject $NewDatabase -Throughput $UpdatedThroughputValue
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue

$UpdatedThroughput = Update-AzCosmosDBSqlDatabaseThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName -Throughput $UpdatedThroughputValue2
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue2

$CosmosDBAccount = Get-AzCosmosDBAccount -ResourceGroupName $rgName -Name $AccountName
$UpdatedThroughput = Update-AzCosmosDBSqlDatabaseThroughput -ParentObject $CosmosDBAccount -Name $DatabaseName -Throughput $UpdatedThroughputValue3
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue3

$NewContainer = Set-AzCosmosDBSqlContainer -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -Throughput $ContainerThroughputValue -Name $ContainerName -PartitionKeyPath $PartitionKeyPathValue -PartitionKeyKind $PartitionKeyKindValue
$ContainerThroughput = Get-AzCosmosDBSqlContainerThroughput -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -Name $ContainerName
Assert-AreEqual $ContainerThroughput.Throughput $ContainerThroughputValue

$UpdatedContainerThroughput = Update-AzCosmosDBSqlContainerThroughput -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -Name $ContainerName -Throughput $UpdatedContainerThroughputValue
Assert-AreEqual $UpdatedContainerThroughput.Throughput $UpdatedContainerThroughputValue

$UpdatedContainerThroughput = Update-AzCosmosDBSqlContainerThroughput -InputObject $NewContainer -Throughput $UpdatedContainerThroughputValue2
Assert-AreEqual $UpdatedContainerThroughput.Throughput $UpdatedContainerThroughputValue2

$UpdatedContainerThroughput = Update-AzCosmosDBSqlContainerThroughput -ParentObject $NewDatabase -Name $ContainerName -Throughput $UpdatedContainerThroughputValue3
Assert-AreEqual $UpdatedContainerThroughput.Throughput $UpdatedContainerThroughputValue3

Remove-AzCosmosDBSqlContainer -InputObject $NewContainer
Remove-AzCosmosDBSqlDatabase -InputObject $NewDatabase
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,12 @@ public void TestTableOperationsCmdletsUsingInputObject()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-TableOperationsCmdletsUsingInputObject");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestTableThroughputCmdlets()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-TableThroughputCmdlets");
}
}
}
28 changes: 28 additions & 0 deletions src/CosmosDB/CosmosDB.Test/ScenarioTests/TableOperationsTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,32 @@ function Test-TableOperationsCmdletsUsingInputObject

$IsTableRemoved = Remove-AzCosmosDBTable -InputObject $Table -PassThru
Assert-AreEqual $IsTableRemoved true
}

function Test-TableThroughputCmdlets
{
$AccountName = "db2527"
$rgName = "CosmosDBResourceGroup2510"
$TableName = "tableName3"

$ThroughputValue = 1200
$UpdatedThroughputValue = 1100
$UpdatedThroughputValue2 = 1000
$UpdatedThroughputValue3 = 900

$NewTable = Set-AzCosmosDBTable -AccountName $AccountName -ResourceGroupName $rgName -Name $TableName -Throughput $ThroughputValue
$Throughput = Get-AzCosmosDBTableThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $TableName
Assert-AreEqual $Throughput.Throughput $ThroughputValue

$UpdatedThroughput = Update-AzCosmosDBTableThroughput -AccountName $AccountName -ResourceGroupName $rgName -Name $TableName -Throughput $UpdatedThroughputValue
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue

$CosmosDBAccount = Get-AzCosmosDBAccount -ResourceGroupName $rgName -Name $AccountName
$UpdatedThroughput = Update-AzCosmosDBTableThroughput -ParentObject $CosmosDBAccount -Name $TableName -Throughput $UpdatedThroughputValue2
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue2

$UpdatedThroughput = Update-AzCosmosDBTableThroughput -InputObject $NewTable -Throughput $UpdatedThroughputValue3
Assert-AreEqual $UpdatedThroughput.Throughput $UpdatedThroughputValue3

Remove-AzCosmosDBTable -InputObject $NewTable
}
Loading