func TestIntervalChunks_GetChunksLater(t *testing.T) {
	desc := someDescriptors(0, 2)
	ps, db := newPullStorage(t, mock.WithSubscribePullChunks(desc...), mock.WithPartialInterval(true))

	go func() {
		<-time.After(200 * time.Millisecond)
		// add chunks to subscribe pull on the storage mock
		db.MorePull(someDescriptors(1, 3, 4)...)
	}()

	addrs, topmost, err := ps.IntervalChunks(context.Background(), 0, 0, 5, limit)
	if err != nil {
		t.Fatal(err)
	}

	if l := len(addrs); l != 5 {
		t.Fatalf("want %d addrs but got %d", 5, l)
	}

	// highest chunk we sent had BinID 5
	exp := uint64(5)
	if topmost != exp {
		t.Fatalf("expected topmost %d but got %d", exp, topmost)
	}
}
// Get some descriptor from the chunk channel, then block for a while
// then add more chunks to the subscribe pull iterator and make sure the loop
// exits correctly.
Get some descriptor from the chunk channel, then block for a while
then add more chunks to the subscribe pull iterator and make sure the loop
exits correctly.
// Get some descriptor from the chunk channel then block for a while // then add more chunks to the subscribe pull iterator and make sure the loop // exits correctly .
func TestIntervalChunks_GetChunksLater(t *testing.T) {
	desc := someDescriptors(0, 2)
	ps, db := newPullStorage(t, mock.WithSubscribePullChunks(desc...), mock.WithPartialInterval(true))
	go func() {
		<-time.After(200 * time.Millisecond)
		db.MorePull(someDescriptors(1, 3, 4)...)
	}()
	addrs, topmost, err := ps.IntervalChunks(context.Background(), 0, 0, 5, limit)
	if err != nil {
		t.Fatal(err)
	}
	if l := len(addrs); l != 5 {
		t.Fatalf("want %d addrs but got %d", 5, l)
	}
	exp := uint64(5)
	if topmost != exp {
		t.Fatalf("expected topmost %d but got %d", exp, topmost)
	}
}
func TestIntervalChunks_GetChunksLater ( t * testing . T ) { desc := someDescriptors ( 0 , 2 ) ps , db := newPullStorage ( t , mock . WithSubscribePullChunks ( desc ... ) , mock . WithPartialInterval ( true ) ) go func ( ) { <- time . After ( 200 * time . Millisecond ) db . MorePull ( someDescriptors ( 1 , 3 , 4 ) ... ) } ( ) addrs , topmost , err := ps . IntervalChunks ( context . Background ( ) , 0 , 0 , 5 , limit ) if err != nil { t . Fatal ( err ) } if l := len ( addrs ) ; l != 5 { t . Fatalf ( " " , 5 , l ) } exp := uint64 ( 5 ) if topmost != exp { t . Fatalf ( " " , exp , topmost ) } }
Get some descriptor from the chunk channel, then block for a while
then add more chunks to the subscribe pull iterator and make sure the loop
exits correctly.
Get some descriptor from the chunk channel then block for a while then add more chunks to the subscribe pull iterator and make sure the loop exits correctly .
// add chunks to subscribe pull on the storage mock // highest chunk we sent had BinID 5