mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-05 06:13:10 +00:00
test: Fix flaky TestMessageBatchPublish (#616)
Messages where being dropped in the validation queue if the machine was not fast enough.
This commit is contained in:
parent
9e5145fb29
commit
38ad16a687
@ -3591,7 +3591,7 @@ func BenchmarkRoundRobinMessageIDScheduler(b *testing.B) {
|
||||
}
|
||||
|
||||
func TestMessageBatchPublish(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
hosts := getDefaultHosts(t, 20)
|
||||
|
||||
@ -3602,7 +3602,7 @@ func TestMessageBatchPublish(t *testing.T) {
|
||||
}
|
||||
const numMessages = 100
|
||||
// +8 to account for the gossiping overhead
|
||||
psubs := getGossipsubs(ctx, hosts, WithMessageIdFn(msgIDFn), WithPeerOutboundQueueSize(numMessages+8))
|
||||
psubs := getGossipsubs(ctx, hosts, WithMessageIdFn(msgIDFn), WithPeerOutboundQueueSize(numMessages+8), WithValidateQueueSize(numMessages+8))
|
||||
|
||||
var topics []*Topic
|
||||
var msgs []*Subscription
|
||||
@ -3643,7 +3643,7 @@ func TestMessageBatchPublish(t *testing.T) {
|
||||
for _, sub := range msgs {
|
||||
got, err := sub.Next(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(sub.err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
id := msgIDFn(got.Message)
|
||||
expected := []byte(fmt.Sprintf("%s it's not a floooooood %s", id, id))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user