Skip to content

Commit

Permalink
Fixing test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
amisi01 committed Jun 16, 2021
1 parent bb4a97c commit ce53089
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task RestorableMongodb32Tests()
// Create client
CosmosDBManagementClient cosmosDBManagementClient = CosmosDBTestUtilities.GetCosmosDBClient(context, handler);
DatabaseAccountGetResults databaseaccount = await RestorableMongoOperationsTests.CreateDatabaseAccountIfNotExists(cosmosDBManagementClient);
DateTime restoreTime = DateTime.ParseExact("15-06-21 23:30:00", "dd-MM-yy HH:mm:ss", null); // use - DateTime.UtcNow.AddMinutes(-1) when generating json file
string restoreTime = "2021-06-15T23:30:00Z"; // use - DateTime.UtcNow.AddMinutes(-1) when generating json file
await RestorableMongodbTestHelper(cosmosDBManagementClient, databaseaccount.InstanceId, restoreTime, resources);
}
}
Expand Down Expand Up @@ -81,15 +81,15 @@ public async Task RestorableMongodb36Tests()
CosmosDBManagementClient cosmosDBManagementClient = CosmosDBTestUtilities.GetCosmosDBClient(context, handler);
DatabaseAccountGetResults databaseaccount = await RestorableMongoOperationsTests.CreateDatabaseAccountIfNotExists(cosmosDBManagementClient);

DateTime restoreTime = DateTime.ParseExact("15-06-21 23:30:00", "dd-MM-yy HH:mm:ss", null); // use - DateTime.UtcNow.AddMinutes(-1) when generating json file
string restoreTime = "2021-06-15T23:30:00Z"; // use - DateTime.UtcNow.AddMinutes(-1) when generating json file
await RestorableMongodbTestHelper(cosmosDBManagementClient, databaseaccount.InstanceId, restoreTime, resources);
}
}

private async Task RestorableMongodbTestHelper(
CosmosDBManagementClient cosmosDBManagementClient,
string sourceAccountInstanceId,
DateTime restoreTimestamp,
string restoreTimestamp,
List<DatabaseRestoreResource> resources = null)
{
List<RestorableMongodbDatabaseGetResult> restorableMongodbDatabases =
Expand All @@ -109,7 +109,7 @@ private async Task RestorableMongodbTestHelper(
Assert.Equal(resource.CollectionNames.Count, restorableMongodbContainers.Count());

List<DatabaseRestoreResource> restorableMongodbResources =
(await cosmosDBManagementClient.RestorableMongodbResources.ListAsync(location, sourceAccountInstanceId, location, restoreTimestamp.ToString())).ToList();
(await cosmosDBManagementClient.RestorableMongodbResources.ListAsync(location, sourceAccountInstanceId, location, restoreTimestamp)).ToList();

ValidateDatabaseRestoreResource(resources, restorableMongodbResources);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Microsoft.Azure.Management.CosmosDB.Models;
using Microsoft.Azure.Management.Resources;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -59,7 +58,7 @@ public async Task RestorableSqlTests()

Assert.Equal(2, restorableSqlContainers.Count());

string restoreTimestamp = DateTime.ParseExact("16-06-21 06:20:00", "dd-MM-yy HH:mm:ss", null).ToString(); // use - DateTime.UtcNow.AddMinutes(-1).ToString() when generating json file
string restoreTimestamp = "2021-06-16T06:30:00Z";// use - DateTime.UtcNow.AddMinutes(-1).ToString() when generating json file
List<DatabaseRestoreResource> restorableSqlResources =
(await cosmosDBManagementClient.RestorableSqlResources.ListAsync(location, restorableDatabaseAccount.Name, location, restoreTimestamp.ToString())).ToList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ public async Task SqlResourceSnapshotFeedTest()
Assert.NotNull(sqlDatabaseGetResults);
Assert.Equal(databaseName, sqlDatabaseGetResults.Name);

string startTime = DateTime.ParseExact("15-06-21 21:30:00", "dd-MM-yy HH:mm:ss", null).ToString();//DateTime.UtcNow.AddHours(-1).ToString();
string endTime = DateTime.ParseExact("16-06-21 17:00:00", "dd-MM-yy HH:mm:ss", null).ToString(); //DateTime.UtcNow.ToString();
string startTime = "2021-06-15T21:30:00Z"; //DateTime.UtcNow.AddHours(-1).ToString();
string endTime = "2021-06-16T17:30:00Z"; //DateTime.UtcNow.ToString();
List<RestorableSqlContainerGetResult> restorableContainerResult = (await cosmosDBManagementClient.RestorableSqlContainers.ListAsync(
location,
databaseAccount.InstanceId,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ce53089

Please sign in to comment.