Fix backup service to have multiple backup instances (#396)

* Allow multiple backups per backup service instance

* Add test to run multiple backups

* Update backup cancelTask method signature

* Fix to have multiple backup instances and add more tests

* Address PR comments

* Remove double new lines

* Add Azure check for backup operations
This commit is contained in:
Kate Shin
2017-06-26 16:21:09 -07:00
committed by GitHub
parent 276f70ab3b
commit cdfdd7bd5a
8 changed files with 241 additions and 127 deletions

View File

@@ -57,10 +57,9 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
// Initialize backup service
DatabaseTaskHelper helper = AdminService.CreateDatabaseTaskHelper(liveConnection.ConnectionInfo, databaseExists: true);
SqlConnection sqlConn = DisasterRecoveryService.GetSqlConnection(liveConnection.ConnectionInfo);
DisasterRecoveryService.Instance.InitializeBackup(helper.DataContainer, sqlConn);
// Get default backup path
BackupConfigInfo backupConfigInfo = DisasterRecoveryService.Instance.GetBackupConfigInfo(sqlConn.Database);
BackupConfigInfo backupConfigInfo = DisasterRecoveryService.Instance.GetBackupConfigInfo(helper.DataContainer, sqlConn, sqlConn.Database);
string backupPath = backupConfigInfo.DefaultBackupFolder + "\\" + databaseName + ".bak";
var backupInfo = new BackupInfo();
@@ -81,8 +80,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
};
// Backup the database
DisasterRecoveryService.Instance.SetBackupInput(backupParams.BackupInfo);
DisasterRecoveryService.Instance.PerformBackup();
BackupOperation backupOperation = DisasterRecoveryService.Instance.SetBackupInput(helper.DataContainer, sqlConn, backupParams.BackupInfo);
DisasterRecoveryService.Instance.PerformBackup(backupOperation);
// Remove the backup file
if (File.Exists(backupPath))