Fixing backup restore launch bug #5797 (and a test) (#6218)

* Fix the launch of backup dialog in server context scenario

* Adding wait to ensure sc tasks complete before test exits
This commit is contained in:
Udeesha Gautam
2019-06-28 17:54:04 -07:00
committed by GitHub
parent e5256b0a61
commit 00c3758d86
2 changed files with 82 additions and 55 deletions

View File

@@ -221,5 +221,24 @@ class SchemaCompareTester {
}); });
assert(foundTask, 'Could not find Script task'); assert(foundTask, 'Could not find Script task');
assert(foundTask.isCancelable, 'The task should be cancellable'); assert(foundTask.isCancelable, 'The task should be cancellable');
if (foundTask.status !== azdata.TaskStatus.Succeeded) {
// wait for all tasks completion before exiting test and cleaning up db otherwise tasks fail
let retry = 10;
let allCompleted = false;
while (retry > 0 && !allCompleted) {
retry--;
await utils.sleep(1000);
allCompleted = true;
let tasks = await taskService.getAllTasks({ listActiveTasksOnly: true });
tasks.tasks.forEach(t => {
if (t.status !== azdata.TaskStatus.Succeeded) {
allCompleted = false;
}
});
}
assert(tasks !== null && tasks.tasks.length > 0, 'Tasks should still show in list. This is to ensure that the tasks actually complete.');
assert(allCompleted === true, 'All tasks should be completed.');
}
} }
} }

View File

@@ -257,6 +257,10 @@ export class BackupAction extends Task {
if (serverInfo && serverInfo.isCloud && profile.providerName === mssqlProviderName) { if (serverInfo && serverInfo.isCloud && profile.providerName === mssqlProviderName) {
return accessor.get<INotificationService>(INotificationService).info(nls.localize('backup.commandNotSupported', 'Backup command is not supported for Azure SQL databases.')); return accessor.get<INotificationService>(INotificationService).info(nls.localize('backup.commandNotSupported', 'Backup command is not supported for Azure SQL databases.'));
} }
if (!profile.databaseName && profile.providerName === mssqlProviderName) {
return accessor.get<INotificationService>(INotificationService).info(nls.localize('backup.commandNotSupportedForServer', 'Backup command is not supported in Server Context. Please select a Database and try again.'));
}
} }
TaskUtilities.showBackup( TaskUtilities.showBackup(
@@ -300,6 +304,10 @@ export class RestoreAction extends Task {
if (serverInfo && serverInfo.isCloud && profile.providerName === mssqlProviderName) { if (serverInfo && serverInfo.isCloud && profile.providerName === mssqlProviderName) {
return accessor.get<INotificationService>(INotificationService).info(nls.localize('restore.commandNotSupported', 'Restore command is not supported for Azure SQL databases.')); return accessor.get<INotificationService>(INotificationService).info(nls.localize('restore.commandNotSupported', 'Restore command is not supported for Azure SQL databases.'));
} }
if (!profile.databaseName && profile.providerName === mssqlProviderName) {
return accessor.get<INotificationService>(INotificationService).info(nls.localize('restore.commandNotSupportedForServer', 'Restore command is not supported in Server Context. Please select a Database and try again.'));
}
} }
TaskUtilities.showRestore( TaskUtilities.showRestore(