Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 805e504

Browse files
committed
test: Add test logging. Temporary only minimal tests to trigger resend fail.
1 parent 9b45471 commit 805e504

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

test/integration/SubscriberResends.test.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ describeRepeats('resends', () => {
110110
await Connection.closeOpen()
111111
throw new Error(`sockets not closed: ${openSockets}`)
112112
}
113+
client.debug('\n\n\n\n')
113114
})
114115

115116
describe('no data', () => {
@@ -201,19 +202,23 @@ describeRepeats('resends', () => {
201202
})
202203

203204
beforeAll(async () => {
205+
client.debug('BEFORE ALL >')
204206
const results = await publishTestMessages.raw(MAX_MESSAGES, {
205207
waitForLast: true,
208+
timestamp: 111111,
206209
})
207210
published = results.map(([msg]: any) => msg)
208211
publishedRequests = results.map(([, req]: any) => req)
212+
client.debug('BEFORE ALL <')
209213
}, WAIT_FOR_STORAGE_TIMEOUT * 2)
210214

211215
beforeEach(async () => {
212216
await client.connect()
213217
// ensure last message is in storage
214218
const lastRequest = publishedRequests[publishedRequests.length - 1]
215219
await waitForStorage(lastRequest)
216-
}, WAIT_FOR_STORAGE_TIMEOUT * 1.2)
220+
client.debug('was stored', lastRequest)
221+
}, WAIT_FOR_STORAGE_TIMEOUT * 2)
217222

218223
it('requests resend', async () => {
219224
const sub = await subscriber.resend({
@@ -298,7 +303,8 @@ describeRepeats('resends', () => {
298303
})
299304

300305
describe('resendSubscribe', () => {
301-
it('sees resends and realtime', async () => {
306+
it.only('sees resends and realtime', async () => {
307+
client.debug('sees resends and realtime >')
302308
const sub = await subscriber.resendSubscribe({
303309
streamId: stream.id,
304310
last: published.length,
@@ -314,7 +320,7 @@ describeRepeats('resends', () => {
314320

315321
const newMessage = Msg()
316322
// eslint-disable-next-line no-await-in-loop
317-
const req = await client.publish(stream.id, newMessage) // should be realtime
323+
const req = await client.publish(stream.id, newMessage, 222222) // should be realtime
318324
published.push(newMessage)
319325
publishedRequests.push(req)
320326
let t!: ReturnType<typeof setTimeout>
@@ -340,9 +346,11 @@ describeRepeats('resends', () => {
340346
expect(sub.realtime.isWritable()).toBe(false)
341347
expect(sub.resend.isReadable()).toBe(false)
342348
expect(sub.resend.isWritable()).toBe(false)
349+
client.debug('sees resends and realtime <')
343350
})
344351

345-
it('sees resends and realtime again', async () => {
352+
it.only('sees resends and realtime again', async () => {
353+
client.debug('sees resends and realtime again >')
346354
const sub = await subscriber.resendSubscribe({
347355
streamId: stream.id,
348356
last: published.length,
@@ -353,9 +361,12 @@ describeRepeats('resends', () => {
353361

354362
const message = Msg()
355363
// eslint-disable-next-line no-await-in-loop
356-
const req = await client.publish(stream.id, message) // should be realtime
364+
client.debug('PUBLISH >')
365+
const req = await client.publish(stream.id, message, 333333) // should be realtime
366+
client.debug('PUBLISH <')
357367
published.push(message)
358368
publishedRequests.push(req)
369+
client.debug('COLLECT >')
359370
const receivedMsgs = await collect(sub, async ({ received }) => {
360371
client.debug({
361372
received: received.length,
@@ -365,6 +376,7 @@ describeRepeats('resends', () => {
365376
await sub.return()
366377
}
367378
})
379+
client.debug('COLLECT <')
368380

369381
const msgs = receivedMsgs
370382
expect(msgs).toHaveLength(published.length)
@@ -375,9 +387,11 @@ describeRepeats('resends', () => {
375387
expect(sub.resend.isReadable()).toBe(false)
376388
expect(sub.resend.isWritable()).toBe(false)
377389
expect(onResent).toHaveBeenCalledTimes(1)
390+
client.debug('sees resends and realtime again <')
378391
})
379392

380-
it('sees resends when no realtime', async () => {
393+
it.only('sees resends when no realtime', async () => {
394+
client.debug('sees resends when no realtime >')
381395
const sub = await subscriber.resendSubscribe({
382396
streamId: stream.id,
383397
last: published.length,
@@ -407,6 +421,7 @@ describeRepeats('resends', () => {
407421
expect(sub.realtime.isWritable()).toBe(false)
408422
expect(sub.resend.isReadable()).toBe(false)
409423
expect(sub.resend.isWritable()).toBe(false)
424+
client.debug('sees resends when no realtime <')
410425
})
411426

412427
it('ends resend if unsubscribed', async () => {
@@ -417,7 +432,7 @@ describeRepeats('resends', () => {
417432

418433
const message = Msg()
419434
// eslint-disable-next-line no-await-in-loop
420-
const req = await client.publish(stream.id, message) // should be realtime
435+
const req = await client.publish(stream.id, message, 444444) // should be realtime
421436
published.push(message)
422437
publishedRequests.push(req)
423438
const receivedMsgs = await collect(sub, async ({ received }) => {
@@ -447,7 +462,7 @@ describeRepeats('resends', () => {
447462

448463
await sub.return()
449464
// eslint-disable-next-line no-await-in-loop
450-
const req = await client.publish(stream.id, message) // should be realtime
465+
const req = await client.publish(stream.id, message, 555555) // should be realtime
451466
published.push(message)
452467
publishedRequests.push(req)
453468
const received = []
@@ -469,7 +484,7 @@ describeRepeats('resends', () => {
469484

470485
const message = Msg()
471486
// eslint-disable-next-line no-await-in-loop
472-
const req = await client.publish(stream.id, message) // should be realtime
487+
const req = await client.publish(stream.id, message, 666666) // should be realtime
473488
published.push(message)
474489
publishedRequests.push(req)
475490

@@ -508,7 +523,7 @@ describeRepeats('resends', () => {
508523

509524
const message = Msg()
510525
// eslint-disable-next-line no-await-in-loop
511-
const req = await client.publish(stream.id, message) // should be realtime
526+
const req = await client.publish(stream.id, message, 777777) // should be realtime
512527
published.push(message)
513528
publishedRequests.push(req)
514529
const END_AFTER = 3

0 commit comments

Comments
 (0)