Skip to content

Commit

Permalink
fix race condition in test case leading to sporadic fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Connum committed Mar 12, 2024
1 parent 7bf3913 commit 32a25f1
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions test/unit/replication-protocol.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
RxAttachmentWriteData,
flatClone,
requestIdlePromise,
promiseSeries,
prepareQuery
} from '../../plugins/core/index.mjs';

Expand Down Expand Up @@ -1107,14 +1108,6 @@ useParallel(testContext + ' (implementation: ' + config.storage.name + ')', () =
});
describe('stability', () => {
it('do many writes while replication is running', async () => {
if (
config.storage.name === 'lokijs' ||
config.storage.name === 'denokv'
) {
// TODO this test fails in about 1/20 times in lokijs
return;
}

const writeAmount = isFastMode() ? 5 : 10;

const masterInstance = await createRxStorageInstance(0);
Expand All @@ -1138,9 +1131,9 @@ useParallel(testContext + ' (implementation: ' + config.storage.name + ')', () =
const document = getDocData();
document.passportId = 'foobar';
const docId = document.passportId;
await Promise.all(
await promiseSeries(
instances
.map(async (instance, idx) => {
.map((instance, idx) => async () => {
// insert
const docData = Object.assign({}, clone(document), {
firstName: idx === 0 ? 'master' : 'fork',
Expand Down

0 comments on commit 32a25f1

Please sign in to comment.