Skip to content

Commit 7d1f22e

Browse files
Merge pull request #653 from dao-xyz/codex/fix-part6-shared-log-flakes
test: stabilize shared-log CI part-6
2 parents 775453c + 8615910 commit 7d1f22e

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

packages/programs/data/shared-log/test/load.spec.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ describe("load", function () {
7272
});
7373

7474
it("load after prune", async () => {
75-
// TODO fix test flakiness
76-
7775
session = await TestSession.connected(2, [
7876
{
7977
directory: "./tmp/shared-log/load-after-prune/" + uuid(),
@@ -110,12 +108,12 @@ describe("load", function () {
110108
replicate: { offset: 0, factor: 0.5 },
111109
replicas: {
112110
min: 1,
113-
} /*
114-
timeUntilRoleMaturity: 0 */,
111+
},
112+
timeUntilRoleMaturity: 0,
115113
},
116114
});
117115

118-
let count = 100;
116+
let count = 64;
119117

120118
for (let i = 0; i < count; i++) {
121119
await db1.add("hello" + i, { meta: { next: [] } });
@@ -129,17 +127,28 @@ describe("load", function () {
129127
replicate: { offset: 0.3, factor: 0.5 },
130128
replicas: {
131129
min: 1,
132-
} /*
133-
timeUntilRoleMaturity: 0 */,
130+
},
131+
timeUntilRoleMaturity: 0,
134132
},
135133
},
136134
);
137135

136+
await Promise.all([
137+
db1.log.waitForReplicator(session.peers[1].identity.publicKey, {
138+
timeout: 15_000,
139+
roleAge: 0,
140+
}),
141+
db2.log.waitForReplicator(session.peers[0].identity.publicKey, {
142+
timeout: 15_000,
143+
roleAge: 0,
144+
}),
145+
]);
146+
138147
await waitForResolved(() => expect(db1.log.log.length).lessThan(count)); // pruning started
139148

140149
await waitForConverged(() => db1.log.log.length); // pruning done
141150

142-
await waitForConverged(() => db2.log.log.length);
151+
await waitForResolved(() => expect(db2.log.log.length).greaterThan(0));
143152
await session.peers[1].stop();
144153
await waitForConverged(() => db1.log.log.length);
145154
const lengthBeforeClose = db1.log.log.length;

packages/programs/data/shared-log/test/rateless-iblt.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ describe("rateless-iblt-syncronizer", () => {
128128
const db2Messages = await collectMessages(db2);
129129

130130
await session.connect();
131+
await Promise.all([
132+
db1.log.waitForReplicator(session.peers[1].identity.publicKey, {
133+
timeout: 15_000,
134+
roleAge: 0,
135+
}),
136+
db2.log.waitForReplicator(session.peers[0].identity.publicKey, {
137+
timeout: 15_000,
138+
roleAge: 0,
139+
}),
140+
]);
131141
await waitForResolved(() =>
132142
expect(db1.log.log.length).to.equal(unsyncedCount),
133143
);

0 commit comments

Comments
 (0)