Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
anodar committed May 16, 2024
1 parent f18419b commit 3373c4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion pubsub/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func (c *Consumer[Request, Response]) listenForInterrupt() {
}

func (c *Consumer[Request, Response]) StopAndWait() {
c.deleteHeartBeat(c.GetContext())
c.StopWaiter.StopAndWait()
}

Expand Down
7 changes: 5 additions & 2 deletions pubsub/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"sort"
"testing"
"time"

"github.com/ethereum/go-ethereum/log"
"github.com/go-redis/redis/v8"
Expand Down Expand Up @@ -202,6 +203,7 @@ func consume(ctx context.Context, t *testing.T, consumers []*Consumer[testReques
}

func TestRedisProduce(t *testing.T) {
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelTrace, true)))
t.Parallel()
for _, tc := range []struct {
name string
Expand All @@ -213,7 +215,7 @@ func TestRedisProduce(t *testing.T) {
},
{
name: "some consumers killed, others should take over their work",
killConsumers: false,
killConsumers: true,
},
} {
t.Run(tc.name, func(t *testing.T) {
Expand All @@ -233,7 +235,7 @@ func TestRedisProduce(t *testing.T) {
if _, err := consumers[i].Consume(ctx); err != nil {
t.Errorf("Error consuming message: %v", err)
}
// Terminate half of the consumers, send interrupt to others.
//Terminate half of the consumers, send interrupt to others.

Check failure on line 238 in pubsub/pubsub_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (race)

commentFormatting: put a space between `//` and comment text (gocritic)

Check failure on line 238 in pubsub/pubsub_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (long)

commentFormatting: put a space between `//` and comment text (gocritic)

Check failure on line 238 in pubsub/pubsub_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

commentFormatting: put a space between `//` and comment text (gocritic)

Check failure on line 238 in pubsub/pubsub_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (stylus)

commentFormatting: put a space between `//` and comment text (gocritic)

Check failure on line 238 in pubsub/pubsub_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (defaults)

commentFormatting: put a space between `//` and comment text (gocritic)
if i%2 == 0 {
consumers[i].StopAndWait()
} else {
Expand All @@ -242,6 +244,7 @@ func TestRedisProduce(t *testing.T) {
}

}
time.Sleep(time.Second)
gotMessages, wantResponses := consume(ctx, t, consumers)
gotResponses, err := awaitResponses(ctx, promises)
if err != nil {
Expand Down

0 comments on commit 3373c4a

Please sign in to comment.