@@ -22,7 +22,6 @@ func TestProcessor_Creation(t *testing.T) {
2222 Config : clickhouse.Config {
2323 Addr : "localhost:9000" ,
2424 },
25- ChunkSize : 10000 ,
2625 }
2726
2827 // Test config validation
@@ -44,7 +43,6 @@ func TestProcessor_ConfigValidation(t *testing.T) {
4443 Config : clickhouse.Config {
4544 Addr : "localhost:9000" ,
4645 },
47- ChunkSize : 10000 ,
4846 },
4947 expectError : false ,
5048 },
@@ -58,9 +56,8 @@ func TestProcessor_ConfigValidation(t *testing.T) {
5856 {
5957 name : "missing addr" ,
6058 config : transaction_structlog.Config {
61- Enabled : true ,
62- Table : "test_table" ,
63- ChunkSize : 10000 ,
59+ Enabled : true ,
60+ Table : "test_table" ,
6461 },
6562 expectError : true ,
6663 },
@@ -71,7 +68,6 @@ func TestProcessor_ConfigValidation(t *testing.T) {
7168 Config : clickhouse.Config {
7269 Addr : "localhost:9000" ,
7370 },
74- ChunkSize : 10000 ,
7571 },
7672 expectError : true ,
7773 },
@@ -104,7 +100,6 @@ func TestProcessor_ConcurrentConfigValidation(t *testing.T) {
104100 Config : clickhouse.Config {
105101 Addr : "localhost:9000" ,
106102 },
107- ChunkSize : 10000 ,
108103 }
109104 results <- cfg .Validate ()
110105 }()
@@ -252,33 +247,6 @@ func TestMemoryManagement(t *testing.T) {
252247
253248 assert .Equal (t , rowCount , cols .Rows (), "Should have correct row count" )
254249
255- // Test that chunking calculations work properly
256- const chunkSize = 100
257-
258- expectedChunks := (rowCount + chunkSize - 1 ) / chunkSize
259-
260- // Verify chunking logic
261- actualChunks := 0
262-
263- for i := 0 ; i < rowCount ; i += chunkSize {
264- actualChunks ++
265-
266- end := i + chunkSize
267- if end > rowCount {
268- end = rowCount
269- }
270-
271- // Verify chunk size constraints
272- chunkLen := end - i
273- if chunkLen <= 0 || chunkLen > chunkSize {
274- t .Errorf ("Invalid chunk size: %d (expected 1-%d)" , chunkLen , chunkSize )
275- }
276- }
277-
278- if actualChunks != expectedChunks {
279- t .Errorf ("Expected %d chunks, got %d" , expectedChunks , actualChunks )
280- }
281-
282250 // Reset columns to free memory
283251 cols .Reset ()
284252 assert .Equal (t , 0 , cols .Rows (), "Reset should clear all rows" )
@@ -302,86 +270,6 @@ func TestMemoryManagement(t *testing.T) {
302270 }
303271}
304272
305- func TestChunkProcessing (t * testing.T ) {
306- tests := []struct {
307- name string
308- inputSize int
309- expectedChunks int
310- chunkSize int
311- }{
312- {
313- name : "small input" ,
314- inputSize : 50 ,
315- expectedChunks : 1 ,
316- chunkSize : 100 ,
317- },
318- {
319- name : "exact chunk size" ,
320- inputSize : 100 ,
321- expectedChunks : 1 ,
322- chunkSize : 100 ,
323- },
324- {
325- name : "multiple chunks" ,
326- inputSize : 250 ,
327- expectedChunks : 3 ,
328- chunkSize : 100 ,
329- },
330- {
331- name : "large input" ,
332- inputSize : 1500 ,
333- expectedChunks : 15 ,
334- chunkSize : 100 ,
335- },
336- }
337-
338- for _ , tt := range tests {
339- t .Run (tt .name , func (t * testing.T ) {
340- // Test chunking logic using Columns
341- cols := transaction_structlog .NewColumns ()
342- now := time .Now ()
343-
344- // Fill columns with test data
345- for i := 0 ; i < tt .inputSize ; i ++ {
346- cols .Append (
347- now , uint64 (i ), "0xtest" , uint32 (0 ), uint64 (21000 ), false , nil ,
348- uint32 (i ), "PUSH1" , uint64 (20000 ), uint64 (3 ), uint64 (3 ), uint64 (3 ), uint64 (1 ),
349- nil , nil , nil , nil , uint32 (0 ), []uint32 {}, "test" ,
350- )
351- }
352-
353- assert .Equal (t , tt .inputSize , cols .Rows (), "Should have correct row count" )
354-
355- // Calculate expected chunks
356- expectedChunks := (tt .inputSize + tt .chunkSize - 1 ) / tt .chunkSize
357-
358- if expectedChunks != tt .expectedChunks {
359- t .Errorf ("Expected %d chunks for %d items, got %d" , tt .expectedChunks , tt .inputSize , expectedChunks )
360- }
361-
362- // Test that the chunking logic would work correctly
363- chunkCount := 0
364-
365- for i := 0 ; i < tt .inputSize ; i += tt .chunkSize {
366- chunkCount ++
367-
368- end := i + tt .chunkSize
369- if end > tt .inputSize {
370- end = tt .inputSize
371- }
372- // Verify chunk boundaries
373- if end <= i {
374- t .Errorf ("Invalid chunk boundaries: start=%d, end=%d" , i , end )
375- }
376- }
377-
378- if chunkCount != tt .expectedChunks {
379- t .Errorf ("Chunking produced %d chunks, expected %d" , chunkCount , tt .expectedChunks )
380- }
381- })
382- }
383- }
384-
385273func TestColumnsAppendAndReset (t * testing.T ) {
386274 cols := transaction_structlog .NewColumns ()
387275 now := time .Now ()
0 commit comments