gecko-dev/browser/components/migration/tests/unit/test_MigrationUtils_timedRetry.js
Marco Bonardo dcf59d8716 Bug 1760074 - Frequent failure of test_MigrationUtils_timedRetry.js. r=Gijs
For how much it may sound strange, sometimes all the reads just happen before
the write, so they won't see the table.
Also fixes a wrong check on previousException.

Differential Revision: https://phabricator.services.mozilla.com/D167478
2023-01-23 15:44:10 +00:00

29 lines
764 B
JavaScript

"use strict";
let tmpFile = FileUtils.getDir("TmpD", [], true);
let dbConn;
add_task(async function setup() {
tmpFile.append("TestDB");
dbConn = await Sqlite.openConnection({ path: tmpFile.path });
registerCleanupFunction(async () => {
await dbConn.close();
await IOUtils.remove(tmpFile.path);
});
});
add_task(async function testgetRowsFromDBWithoutLocksRetries() {
let deferred = PromiseUtils.defer();
let promise = MigrationUtils.getRowsFromDBWithoutLocks(
tmpFile.path,
"Temp DB",
"SELECT * FROM moz_temp_table",
deferred.promise
);
await new Promise(resolve => do_timeout(50, resolve));
dbConn
.execute("CREATE TABLE moz_temp_table (id INTEGER PRIMARY KEY)")
.then(deferred.resolve);
await promise;
});