Skip to content

Commit 8e5b2a4

Browse files
authored
[Az.CosmosDB] Add table and gremlin APIs for point-in-time restore (Azure#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
1 parent 6d8b8f4 commit 8e5b2a4

File tree

92 files changed

+59507
-64380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+59507
-64380
lines changed

src/CosmosDB/CosmosDB.Test/CosmosDB.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ItemGroup>
77
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.1" />
88
<PackageReference Include="Microsoft.Azure.Management.Network" Version="26.0.0" />
9-
<PackageReference Include="Microsoft.Azure.Management.CosmosDB" Version="3.7.0-preview" />
9+
<PackageReference Include="Microsoft.Azure.Management.CosmosDB" Version="3.9.1-preview" />
1010
</ItemGroup>
1111
<ItemGroup>
1212
<Folder Include="SessionRecords\Microsoft.Azure.Commands.CosmosDB.Test.ScenarioTests.ScenarioTest.ServiceTests\" />

src/CosmosDB/CosmosDB.Test/ScenarioTests/AccountTests.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ function Test-AccountRelatedCmdletsUsingObject
195195

196196
function Test-AddRegionOperation
197197
{
198-
$rgName = "CosmosDBResourceGroup5"
198+
$rgName = "CosmosDBResourceGroup9"
199199
$location = "East US"
200200
$locationlist = "East US", "West US"
201-
$cosmosDBAccountName = "testupdateregionpowershell1"
201+
$cosmosDBAccountName = "testupdateregionpowershell11"
202202
$resourceGroup = New-AzResourceGroup -ResourceGroupName $rgName -Location $location
203203

204204
try {
@@ -214,6 +214,7 @@ function Test-AddRegionOperation
214214
}
215215

216216
$updatedCosmosDBAccount = Update-AzCosmosDBAccountRegion -ResourceGroupName $rgName -Name $cosmosDBAccountName -Location $locationlist
217+
Start-Sleep -s 60
217218
$updatedCosmosDBAccount = Get-AzCosmosDBAccount -ResourceGroupName $rgName -Name $cosmosDBAccountName
218219
Assert-AreEqual $updatedCosmosDBAccount.Locations.Count 2
219220
}

src/CosmosDB/CosmosDB.Test/ScenarioTests/GremlinOperationsTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ Test Gremlin migrate throughput cmdlets
340340
#>
341341
function Test-GremlinMigrateThroughputCmdlets
342342
{
343-
$AccountName = "gremlin-db1053"
343+
$AccountName = "gremlin-db1054"
344344
$rgName = "CosmosDBResourceGroup53"
345345
$DatabaseName = "dbName4"
346346
$GraphName = "graphName"

src/CosmosDB/CosmosDB.Test/ScenarioTests/ManagedCassandraOperationsTests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ function Test-ManagedCassandraCreateUpdateGetCmdlets
5050
# $SubnetId = $vnet.Subnets[0].Id
5151
#
5252
# then set this variable to the $SubnetId value produced by the script.
53-
$SubnetId = "/subscriptions/dd31ecae-4522-468e-8b27-5befd051dd53/resourceGroups/nova-powershell-tests-rg/providers/Microsoft.Network/virtualNetworks/cassandra-mi-vnet/subnets/default"
54-
53+
$SubnetId = "/subscriptions/80be3961-0521-4a0a-8570-5cd5a4e2f98c/resourceGroups/nova-powershell-tests-rg/providers/Microsoft.Network/virtualNetworks/cassandra-mi-vnet/subnets/default"
54+
$resourceGroup = New-AzResourceGroup -ResourceGroupName $RgName -Location $Location
5555
$initialClusterCount = (Get-AzManagedCassandraCluster -ResourceGroupName $RgName).Count
56-
56+
5757
$response = New-AzManagedCassandraCluster `
5858
-ResourceGroupName $RgName `
5959
-ClusterName $ClusterName `
@@ -85,7 +85,7 @@ function Test-ManagedCassandraCreateUpdateGetCmdlets
8585
{
8686
break
8787
}
88-
Start-TestSleep -Seconds 1
88+
Start-Sleep -s 1
8989
}
9090
$response = Get-AzManagedCassandraCluster -ResourceId $clusterId
9191
Assert-AreEqual 3 $response.Properties.ExternalSeedNodes.Count

src/CosmosDB/CosmosDB.Test/ScenarioTests/MongoOperationsTests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ Test MongoDB RBAC cmdlets using Name paramter set
453453
#>
454454
function Test-MongoRBACCmdlets
455455
{
456-
$AccountName = "mongo-db00044"
457-
$rgName = "mongorbactest"
456+
$AccountName = "mongo-db0004414"
457+
$rgName = "mongorbactest-4414"
458458
#$rgName = "CosmosDBResourceGroup44"
459459
$DatabaseName = "dbName"
460460
$CollectionName = "collection1"
@@ -469,12 +469,12 @@ function Test-MongoRBACCmdlets
469469
$CollectionName2 = "collection2"
470470
$ThroughputValue = 500
471471
$UpdatedCollectionThroughputValue = 600
472-
$location = "West US 2"
472+
$location = "East US"
473473
$apiKind = "MongoDB"
474474
$serverVersion = "3.6" #3.2 or 3.6
475475
$consistencyLevel = "Session"
476476
$locations = @()
477-
$locations += New-AzCosmosDBLocationObject -LocationName "West Us 2" -FailoverPriority 0 -IsZoneRedundant 0
477+
$locations += New-AzCosmosDBLocationObject -LocationName "East US" -FailoverPriority 0 -IsZoneRedundant 0
478478
$subscriptionId = $(getVariable "SubscriptionId")
479479
$RoleName1 = "mongoPSRole1"
480480
$RoleDefinitionId1 = $DatabaseName + "." + $RoleName1

src/CosmosDB/CosmosDB.Test/ScenarioTests/RestoreTests.cs

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,29 @@ namespace Microsoft.Azure.Commands.CosmosDB.Test.ScenarioTests.ScenarioTest
1919
{
2020
public class RestoreTests : CosmosDBTestRunner
2121
{
22-
public RestoreTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
22+
public RestoreTests(Xunit.Abstractions.ITestOutputHelper output): base(output)
2323
{
2424
}
2525

26-
[Fact(Skip = "Unrecognized time format for linux/mac.")]
26+
[Fact]
27+
[Trait(Category.AcceptanceType, Category.CheckIn)]
28+
public void TestSqlRestoreAccountCmdlets()
29+
{
30+
TestRunner.RunTestScript("Test-SqlRestoreAccountCmdlets");
31+
}
32+
33+
[Fact]
2734
[Trait(Category.AcceptanceType, Category.CheckIn)]
28-
public void TestRestoreAccountCmdlets()
35+
public void TestSqlRestoreFromNewAccountCmdlets()
2936
{
30-
TestRunner.RunTestScript("Test-RestoreAccountCmdlets");
37+
TestRunner.RunTestScript("Test-SqlRestoreFromNewAccountCmdlets");
3138
}
3239

3340
[Fact]
3441
[Trait(Category.AcceptanceType, Category.CheckIn)]
35-
public void TestRestoreFromNewAccountCmdlets()
42+
public void TestMongoDBRestoreFromNewAccountCmdlets()
3643
{
37-
TestRunner.RunTestScript("Test-RestoreFromNewAccountCmdlets");
44+
TestRunner.RunTestScript("Test-MongoDBRestoreFromNewAccountCmdlets");
3845
}
3946

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

61+
[Fact]
62+
[Trait(Category.AcceptanceType, Category.CheckIn)]
63+
public void TestGremlinRestoreAccountCmdlets()
64+
{
65+
TestRunner.RunTestScript("Test-GremlinRestoreAccountCmdlets");
66+
}
67+
68+
[Fact]
69+
[Trait(Category.AcceptanceType, Category.CheckIn)]
70+
public void TestGremlinRestoreFromNewAccountCmdlets()
71+
{
72+
TestRunner.RunTestScript("Test-GremlinRestoreFromNewAccountCmdlets");
73+
}
74+
75+
[Fact]
76+
[Trait(Category.AcceptanceType, Category.CheckIn)]
77+
public void TestTableRestoreAccountCmdlets()
78+
{
79+
TestRunner.RunTestScript("Test-TableRestoreAccountCmdlets");
80+
}
81+
82+
[Fact]
83+
[Trait(Category.AcceptanceType, Category.CheckIn)]
84+
public void TestTableRestoreFromNewAccountCmdlets()
85+
{
86+
TestRunner.RunTestScript("Test-TableRestoreFromNewAccountCmdlets");
87+
}
88+
5489
[Fact]
5590
[Trait(Category.AcceptanceType, Category.CheckIn)]
5691
public void TestSqlContainerBackupInformationCmdLets()
@@ -65,6 +100,20 @@ public void TestMongoDBCollectionBackupInformationCmdLets()
65100
TestRunner.RunTestScript("Test-MongoDBCollectionBackupInformationCmdLets");
66101
}
67102

103+
[Fact]
104+
[Trait(Category.AcceptanceType, Category.CheckIn)]
105+
public void TestGremlinGraphBackupInformationCmdLets()
106+
{
107+
TestRunner.RunTestScript("Test-GremlinGraphBackupInformationCmdLets");
108+
}
109+
110+
[Fact]
111+
[Trait(Category.AcceptanceType, Category.CheckIn)]
112+
public void TestTableBackupInformationCmdLets()
113+
{
114+
TestRunner.RunTestScript("Test-TableBackupInformationCmdLets");
115+
}
116+
68117
[Fact(Skip= "Flaky test: Need diagnose that the test is not creating the valid account for backup")]
69118
[Trait(Category.AcceptanceType, Category.CheckIn)]
70119
public void TestUpdateCosmosDBAccountBackupPolicyCmdLet()

0 commit comments

Comments
 (0)