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

Function TestChunkQueue_Retry

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

Source from the content-addressed store, hash-verified

414}
415
416func TestChunkQueue_Retry(t *testing.T) {
417 queue, teardown := setupChunkQueue(t)
418 defer teardown()
419
420 // Allocate and add all chunks to the queue
421 for i := uint32(0); i < queue.Size(); i++ {
422 _, err := queue.Allocate()
423 require.NoError(t, err)
424 _, err = queue.Add(&chunk{Height: 3, Format: 1, Index: i, Chunk: []byte{byte(i)}})
425 require.NoError(t, err)
426 _, err = queue.Next()
427 require.NoError(t, err)
428 }
429
430 // Retrying a couple of chunks makes Next() return them, but they are not allocatable
431 queue.Retry(3)
432 queue.Retry(1)
433
434 _, err := queue.Allocate()
435 assert.Equal(t, errDone, err)
436
437 chunk, err := queue.Next()
438 require.NoError(t, err)
439 assert.EqualValues(t, 1, chunk.Index)
440
441 chunk, err = queue.Next()
442 require.NoError(t, err)
443 assert.EqualValues(t, 3, chunk.Index)
444
445 _, err = queue.Next()
446 assert.Equal(t, errDone, err)
447}
448
449func TestChunkQueue_RetryAll(t *testing.T) {
450 queue, teardown := setupChunkQueue(t)

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected