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

Commit 5b3224a

Browse files
committed
Fixing MultipleClients test. WIP.
1 parent 6e52f77 commit 5b3224a

File tree

3 files changed

+29
-41
lines changed

3 files changed

+29
-41
lines changed

package-lock.json

Lines changed: 23 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/integration/MessagePipeline.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ describe('MessagePipeline', () => {
177177
const onPipelineError = jest.fn((err) => {
178178
throw err
179179
})
180-
const msgStream = new PushQueue([
181-
])
180+
const msgStream = new PushQueue([])
182181
const p = MessagePipeline(client, {
183182
...MOCK_INVALID_GROUP_KEY_MESSAGE.messageId,
184183
msgStream,

test/integration/MultipleClients.test.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ describeRepeats('PubSub with multiple clients', () => {
449449
addAfter(() => {
450450
counterId.clear(publisherId) // prevent overflows in counter
451451
})
452+
452453
const publishTestMessages = getPublishTestMessages(pubClient, {
453454
stream,
454455
waitForLast: true,
@@ -576,7 +577,7 @@ describeRepeats('PubSub with multiple clients', () => {
576577
/* eslint-enable no-await-in-loop */
577578
const published = {}
578579
await Promise.all(publishers.map(async (pubClient) => {
579-
const publisherId = await pubClient.getPublisherId()
580+
const publisherId = (await pubClient.getPublisherId()).toLowerCase()
580581
const publishTestMessages = getPublishTestMessages(pubClient, {
581582
stream,
582583
waitForLast: true,
@@ -590,14 +591,6 @@ describeRepeats('PubSub with multiple clients', () => {
590591
})
591592
}))
592593

593-
await wait(5000)
594-
595-
mainClient.debug('%j', {
596-
published,
597-
receivedMessagesMain,
598-
receivedMessagesOther,
599-
})
600-
601594
// eslint-disable-next-line no-inner-declarations
602595
function checkMessages(received) {
603596
for (const [key, msgs] of Object.entries(published)) {
@@ -666,7 +659,7 @@ describeRepeats('PubSub with multiple clients', () => {
666659
msgs.push(msg)
667660
receivedMessagesMain[streamMessage.getPublisherId()] = msgs
668661
if (Object.values(receivedMessagesMain).every((m) => m.length === MAX_MESSAGES)) {
669-
mainSub.end()
662+
mainSub.cancel()
670663
}
671664
})
672665

@@ -679,7 +672,7 @@ describeRepeats('PubSub with multiple clients', () => {
679672
let counter = 0
680673
/* eslint-enable no-await-in-loop */
681674
await Promise.all(publishers.map(async (pubClient) => {
682-
const publisherId = pubClient.getPublisherId()
675+
const publisherId = (await pubClient.getPublisherId()).toString()
683676
const publishTestMessages = getPublishTestMessages(pubClient, {
684677
stream,
685678
waitForLast: true,
@@ -702,7 +695,7 @@ describeRepeats('PubSub with multiple clients', () => {
702695
msgs.push(msg)
703696
receivedMessagesOther[streamMessage.getPublisherId()] = msgs
704697
if (msgs.length === MAX_MESSAGES) {
705-
await otherSub.end()
698+
await otherSub.cancel()
706699
}
707700
})
708701
}
@@ -712,12 +705,6 @@ describeRepeats('PubSub with multiple clients', () => {
712705

713706
await wait(15000)
714707

715-
mainClient.debug('%j', {
716-
published,
717-
receivedMessagesMain,
718-
receivedMessagesOther,
719-
})
720-
721708
checkMessages(receivedMessagesMain)
722709
checkMessages(receivedMessagesOther)
723710
} finally {

0 commit comments

Comments
 (0)