Skip to content

Commit

Permalink
test(store): add multi-subscription heightSub testcase (#242)
Browse files Browse the repository at this point in the history
Coming out as a result of reviewing #239
  • Loading branch information
Wondertan authored Jan 14, 2025
1 parent 996923f commit 3cf61a8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions store/heightsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ func TestHeightSub(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, h)
}

// assert multiple subscriptions work
{
ch := make(chan error, 10)
for range cap(ch) {
go func() {
_, err := hs.Sub(ctx, 103)
ch <- err
}()
}

time.Sleep(time.Millisecond * 10)

h3 := headertest.RandDummyHeader(t)
h3.HeightI = 103
hs.Pub(h3)

for range cap(ch) {
assert.NoError(t, <-ch)
}
}
}

func TestHeightSubCancellation(t *testing.T) {
Expand Down

0 comments on commit 3cf61a8

Please sign in to comment.