MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestChunkQueue_RetryAll

Function TestChunkQueue_RetryAll

statesync/chunks_test.go:449–479  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

447}
448
449func TestChunkQueue_RetryAll(t *testing.T) {
450 queue, teardown := setupChunkQueue(t)
451 defer teardown()
452
453 // Allocate and add all chunks to the queue
454 for i := uint32(0); i < queue.Size(); i++ {
455 _, err := queue.Allocate()
456 require.NoError(t, err)
457 _, err = queue.Add(&chunk{Height: 3, Format: 1, Index: i, Chunk: []byte{byte(i)}})
458 require.NoError(t, err)
459 _, err = queue.Next()
460 require.NoError(t, err)
461 }
462
463 _, err := queue.Next()
464 assert.Equal(t, errDone, err)
465
466 queue.RetryAll()
467
468 _, err = queue.Allocate()
469 assert.Equal(t, errDone, err)
470
471 for i := uint32(0); i < queue.Size(); i++ {
472 chunk, err := queue.Next()
473 require.NoError(t, err)
474 assert.EqualValues(t, i, chunk.Index)
475 }
476
477 _, err = queue.Next()
478 assert.Equal(t, errDone, err)
479}
480
481func TestChunkQueue_Size(t *testing.T) {
482 queue, teardown := setupChunkQueue(t)

Callers

nothing calls this directly

Calls 7

setupChunkQueueFunction · 0.85
AllocateMethod · 0.80
RetryAllMethod · 0.80
SizeMethod · 0.65
EqualMethod · 0.65
AddMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected