createTestBlock with the number of given traces and the needed sizes. Trace IDs are guaranteed to be monotonically increasing so that the block will be iterated in order. nolint: revive
(t testing.TB, ctx context.Context, cfg *common.BlockConfig, r backend.Reader, w backend.Writer, traceCount, batchCount, spanCount, replicationFactor int, dc backend.DedicatedColumns)
| 111 | // the block will be iterated in order. |
| 112 | // nolint: revive |
| 113 | func createTestBlock(t testing.TB, ctx context.Context, cfg *common.BlockConfig, r backend.Reader, w backend.Writer, traceCount, batchCount, spanCount, replicationFactor int, dc backend.DedicatedColumns) *backend.BlockMeta { |
| 114 | inMeta := &backend.BlockMeta{ |
| 115 | TenantID: tenantID, |
| 116 | BlockID: backend.NewUUID(), |
| 117 | TotalObjects: int64(traceCount), |
| 118 | ReplicationFactor: uint32(replicationFactor), |
| 119 | DedicatedColumns: dc, |
| 120 | } |
| 121 | |
| 122 | sb, outMeta := newStreamingBlock(ctx, cfg, inMeta, r, w, tempo_io.NewBufferedWriter) |
| 123 | |
| 124 | for i := 0; i < traceCount; i++ { |
| 125 | id := make([]byte, 16) |
| 126 | _, err := crand.Read(id) |
| 127 | require.NoError(t, err) |
| 128 | |
| 129 | tr := test.AddDedicatedAttributes(test.MakeTraceWithSpanCount(batchCount, spanCount, id)) |
| 130 | trp, connected := traceToParquet(inMeta, id, tr, nil) |
| 131 | require.False(t, connected) |
| 132 | |
| 133 | require.NoError(t, sb.Add(trp, 0, 0)) |
| 134 | if sb.EstimatedBufferedBytes() > 20_000_000 { |
| 135 | _, err := sb.Flush() |
| 136 | require.NoError(t, err) |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | _, err := sb.Complete() |
| 141 | require.NoError(t, err) |
| 142 | |
| 143 | return outMeta |
| 144 | } |
| 145 | |
| 146 | func TestValueAlloc(_ *testing.T) { |
| 147 | _ = make([]parquet.Value, 1_000_000) |
no test coverage detected