MCPcopy
hub / github.com/segmentio/kafka-go / testBatchQueueGetWorksAfterClose

Function testBatchQueueGetWorksAfterClose

writer_test.go:73–97  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func testBatchQueueGetWorksAfterClose(t *testing.T) {
74 bq := newBatchQueue(10)
75 enqueueBatches := []*writeBatch{
76 newWriteBatch(time.Now(), time.Hour*100),
77 newWriteBatch(time.Now(), time.Hour*100),
78 }
79
80 for _, batch := range enqueueBatches {
81 put := bq.Put(batch)
82 if !put {
83 t.Fatal("failed to put batch into queue")
84 }
85 }
86
87 bq.Close()
88
89 batchesGotten := 0
90 for batchesGotten != 2 {
91 dequeueBatch := bq.Get()
92 if dequeueBatch == nil {
93 t.Fatalf("no batch returned from get")
94 }
95 batchesGotten++
96 }
97}
98
99func TestWriter(t *testing.T) {
100 tests := []struct {

Callers

nothing calls this directly

Calls 5

newBatchQueueFunction · 0.85
newWriteBatchFunction · 0.85
PutMethod · 0.80
GetMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected