Commit 69af4e5d authored by Andreas Bigger's avatar Andreas Bigger

fix peer scores test

parent 4ff4d356
...@@ -138,21 +138,22 @@ func (testSuite *PeerScoresTestSuite) TestNegativeScores() { ...@@ -138,21 +138,22 @@ func (testSuite *PeerScoresTestSuite) TestNegativeScores() {
// Create subscriptions // Create subscriptions
var subs []*pubsub.Subscription var subs []*pubsub.Subscription
var topics []*pubsub.Topic
for _, ps := range pubsubs { for _, ps := range pubsubs {
topic, err := ps.Join("test") topic, err := ps.Join("test")
testSuite.NoError(err) testSuite.NoError(err)
sub, err := topic.Subscribe() sub, err := topic.Subscribe()
testSuite.NoError(err) testSuite.NoError(err)
subs = append(subs, sub) subs = append(subs, sub)
topics = append(topics, topic)
} }
// Wait and then publish messages // Wait and then publish messages
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
for i := 0; i < 20; i++ { for i := 0; i < 20; i++ {
msg := []byte(fmt.Sprintf("message %d", i)) msg := []byte(fmt.Sprintf("message %d", i))
topic, err := pubsubs[i%20].Join("test") topic := topics[i]
testSuite.NoError(err) err := topic.Publish(ctx, msg)
err = topic.Publish(ctx, msg)
testSuite.NoError(err) testSuite.NoError(err)
time.Sleep(20 * time.Millisecond) time.Sleep(20 * time.Millisecond)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment