Skip to content

Commit

Permalink
[Az.CosmosDB] Add table and gremlin APIs for point-in-time restore (A…
Browse files Browse the repository at this point in the history
…zure#21132)

* Added table-gremlin changes to stable 2022-11-15 version

fixed restore tests

Fixed casting issues in *restorableResources.cs

Fixed bugs related to casting, checking deleted account and timestamp

Updated version and changelog

Added test and updated change log

fixed text TestMongoRBACCmdlets

Added online help links

* Updated session records

* updated names

* trying fixing 3 cases

* Updated session records

* Fixed playback test

* trying fix

* fixing static analysis errors

* fix src/CosmosDB/CosmosDB/help/Get-AzCosmosDBGremlinRestorableGraph.md
  • Loading branch information
kshittiz7 authored Mar 15, 2023
1 parent 6d8b8f4 commit 8e5b2a4
Show file tree
Hide file tree
Showing 92 changed files with 59,507 additions and 64,380 deletions.
2 changes: 1 addition & 1 deletion src/CosmosDB/CosmosDB.Test/CosmosDB.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.1" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="26.0.0" />
<PackageReference Include="Microsoft.Azure.Management.CosmosDB" Version="3.7.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.CosmosDB" Version="3.9.1-preview" />
</ItemGroup>
<ItemGroup>
<Folder Include="SessionRecords\Microsoft.Azure.Commands.CosmosDB.Test.ScenarioTests.ScenarioTest.ServiceTests\" />
Expand Down
5 changes: 3 additions & 2 deletions src/CosmosDB/CosmosDB.Test/ScenarioTests/AccountTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ function Test-AccountRelatedCmdletsUsingObject

function Test-AddRegionOperation
{
$rgName = "CosmosDBResourceGroup5"
$rgName = "CosmosDBResourceGroup9"
$location = "East US"
$locationlist = "East US", "West US"
$cosmosDBAccountName = "testupdateregionpowershell1"
$cosmosDBAccountName = "testupdateregionpowershell11"
$resourceGroup = New-AzResourceGroup -ResourceGroupName $rgName -Location $location

try {
Expand All @@ -214,6 +214,7 @@ function Test-AddRegionOperation
}

$updatedCosmosDBAccount = Update-AzCosmosDBAccountRegion -ResourceGroupName $rgName -Name $cosmosDBAccountName -Location $locationlist
Start-Sleep -s 60
$updatedCosmosDBAccount = Get-AzCosmosDBAccount -ResourceGroupName $rgName -Name $cosmosDBAccountName
Assert-AreEqual $updatedCosmosDBAccount.Locations.Count 2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ Test Gremlin migrate throughput cmdlets
#>
function Test-GremlinMigrateThroughputCmdlets
{
$AccountName = "gremlin-db1053"
$AccountName = "gremlin-db1054"
$rgName = "CosmosDBResourceGroup53"
$DatabaseName = "dbName4"
$GraphName = "graphName"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ function Test-ManagedCassandraCreateUpdateGetCmdlets
# $SubnetId = $vnet.Subnets[0].Id
#
# then set this variable to the $SubnetId value produced by the script.
$SubnetId = "/subscriptions/dd31ecae-4522-468e-8b27-5befd051dd53/resourceGroups/nova-powershell-tests-rg/providers/Microsoft.Network/virtualNetworks/cassandra-mi-vnet/subnets/default"

$SubnetId = "/subscriptions/80be3961-0521-4a0a-8570-5cd5a4e2f98c/resourceGroups/nova-powershell-tests-rg/providers/Microsoft.Network/virtualNetworks/cassandra-mi-vnet/subnets/default"
$resourceGroup = New-AzResourceGroup -ResourceGroupName $RgName -Location $Location
$initialClusterCount = (Get-AzManagedCassandraCluster -ResourceGroupName $RgName).Count

$response = New-AzManagedCassandraCluster `
-ResourceGroupName $RgName `
-ClusterName $ClusterName `
Expand Down Expand Up @@ -85,7 +85,7 @@ function Test-ManagedCassandraCreateUpdateGetCmdlets
{
break
}
Start-TestSleep -Seconds 1
Start-Sleep -s 1
}
$response = Get-AzManagedCassandraCluster -ResourceId $clusterId
Assert-AreEqual 3 $response.Properties.ExternalSeedNodes.Count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ Test MongoDB RBAC cmdlets using Name paramter set
#>
function Test-MongoRBACCmdlets
{
$AccountName = "mongo-db00044"
$rgName = "mongorbactest"
$AccountName = "mongo-db0004414"
$rgName = "mongorbactest-4414"
#$rgName = "CosmosDBResourceGroup44"
$DatabaseName = "dbName"
$CollectionName = "collection1"
Expand All @@ -469,12 +469,12 @@ function Test-MongoRBACCmdlets
$CollectionName2 = "collection2"
$ThroughputValue = 500
$UpdatedCollectionThroughputValue = 600
$location = "West US 2"
$location = "East US"
$apiKind = "MongoDB"
$serverVersion = "3.6" #3.2 or 3.6
$consistencyLevel = "Session"
$locations = @()
$locations += New-AzCosmosDBLocationObject -LocationName "West Us 2" -FailoverPriority 0 -IsZoneRedundant 0
$locations += New-AzCosmosDBLocationObject -LocationName "East US" -FailoverPriority 0 -IsZoneRedundant 0
$subscriptionId = $(getVariable "SubscriptionId")
$RoleName1 = "mongoPSRole1"
$RoleDefinitionId1 = $DatabaseName + "." + $RoleName1
Expand Down
61 changes: 55 additions & 6 deletions src/CosmosDB/CosmosDB.Test/ScenarioTests/RestoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,29 @@ namespace Microsoft.Azure.Commands.CosmosDB.Test.ScenarioTests.ScenarioTest
{
public class RestoreTests : CosmosDBTestRunner
{
public RestoreTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
public RestoreTests(Xunit.Abstractions.ITestOutputHelper output): base(output)
{
}

[Fact(Skip = "Unrecognized time format for linux/mac.")]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSqlRestoreAccountCmdlets()
{
TestRunner.RunTestScript("Test-SqlRestoreAccountCmdlets");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRestoreAccountCmdlets()
public void TestSqlRestoreFromNewAccountCmdlets()
{
TestRunner.RunTestScript("Test-RestoreAccountCmdlets");
TestRunner.RunTestScript("Test-SqlRestoreFromNewAccountCmdlets");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRestoreFromNewAccountCmdlets()
public void TestMongoDBRestoreFromNewAccountCmdlets()
{
TestRunner.RunTestScript("Test-RestoreFromNewAccountCmdlets");
TestRunner.RunTestScript("Test-MongoDBRestoreFromNewAccountCmdlets");
}

[Fact]
Expand All @@ -51,6 +58,34 @@ public void TestRestoreFailuresAccountCmdlets()
TestRunner.RunTestScript("Test-RestoreFailuresAccountCmdlets");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGremlinRestoreAccountCmdlets()
{
TestRunner.RunTestScript("Test-GremlinRestoreAccountCmdlets");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGremlinRestoreFromNewAccountCmdlets()
{
TestRunner.RunTestScript("Test-GremlinRestoreFromNewAccountCmdlets");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestTableRestoreAccountCmdlets()
{
TestRunner.RunTestScript("Test-TableRestoreAccountCmdlets");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestTableRestoreFromNewAccountCmdlets()
{
TestRunner.RunTestScript("Test-TableRestoreFromNewAccountCmdlets");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSqlContainerBackupInformationCmdLets()
Expand All @@ -65,6 +100,20 @@ public void TestMongoDBCollectionBackupInformationCmdLets()
TestRunner.RunTestScript("Test-MongoDBCollectionBackupInformationCmdLets");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGremlinGraphBackupInformationCmdLets()
{
TestRunner.RunTestScript("Test-GremlinGraphBackupInformationCmdLets");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestTableBackupInformationCmdLets()
{
TestRunner.RunTestScript("Test-TableBackupInformationCmdLets");
}

[Fact(Skip= "Flaky test: Need diagnose that the test is not creating the valid account for backup")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestUpdateCosmosDBAccountBackupPolicyCmdLet()
Expand Down
Loading

0 comments on commit 8e5b2a4

Please sign in to comment.