Skip to content

Commit

Permalink
MDL-57698 sqlsrv: Unit test deadlock case
Browse files Browse the repository at this point in the history
  • Loading branch information
John Okely authored and xow committed Jul 21, 2017
1 parent 32269b2 commit 6b152ab
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions backup/controller/tests/controller_test.php
Expand Up @@ -149,6 +149,32 @@ public function test_restore_controller_is_executing() {
}
$this->assertTrue($alltrue);
}

/**
* Test restore of deadlock causing backup.
*/
public function test_restore_of_deadlock_causing_backup() {
global $USER, $CFG;
$this->preventResetByRollback();

$foldername = 'deadlock';
$fp = get_file_packer('application/vnd.moodle.backup');
$tempdir = $CFG->dataroot . '/temp/backup/' . $foldername;
$files = $fp->extract_to_pathname($CFG->dirroot . '/backup/controller/tests/fixtures/deadlock.mbz', $tempdir);

$this->setAdminUser();
$controller = new restore_controller(
'deadlock',
$this->courseid,
backup::INTERACTIVE_NO,
backup::MODE_GENERAL,
$USER->id,
backup::TARGET_NEW_COURSE
);
$this->assertTrue($controller->execute_precheck());
$controller->execute_plan();
$controller->destroy();
}
}


Expand Down
Binary file added backup/controller/tests/fixtures/deadlock.mbz
Binary file not shown.

0 comments on commit 6b152ab

Please sign in to comment.