From 7adc14650ab7fa873cc82d1817f101d325eb85a6 Mon Sep 17 00:00:00 2001 From: "timmy.yuan" Date: Wed, 14 Oct 2026 16:40:29 +0800 Subject: [PATCH] test(cpworker): use an 8 MB capture buffer in the timeout_ms > 0 integration tests CLOUD-PROBE-BUILD #175 and #176 failed in TestIdleZMQFlush and TestIdleCapture with "worker did not start polling": cpworker logged the libpcap version and then did not reach "start poll packets" within the tests' 5 s wait. Each build failed different timeout_10ms subtests, and #174 passed on the same commit. With timeout_ms > 0 and the default 256 MB buffer, cpworker startup is slow when the host is short of free memory. In a VM with memory filled to swap, startup took up to ~1 s with timeout_ms 10 and 256 MB, and stayed under ~170 ms with an 8 MB buffer or timeout_ms 0. The tests send at most a few thousand packets, so the idle capture tests and the reload dest_a/dest_b configs (also timeout_ms 10) now set buffer_size_mb 8. --- cpworker/tests/integration/idle_capture_test.go | 3 +++ .../tests/integration/testdata/reload/pipeline_dest_a.json | 2 +- .../tests/integration/testdata/reload/pipeline_dest_b.json | 2 +- cpworker/tests/integration/testdata/reload/rtc_dest_a.json | 2 +- cpworker/tests/integration/testdata/reload/rtc_dest_b.json | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cpworker/tests/integration/idle_capture_test.go b/cpworker/tests/integration/idle_capture_test.go index fe9d92a7..c131264f 100644 --- a/cpworker/tests/integration/idle_capture_test.go +++ b/cpworker/tests/integration/idle_capture_test.go @@ -62,6 +62,9 @@ func writeIdleCaptureConfig(t *testing.T, outputDir string, pipeline bool, timeo "snaplen": 2048, "bpf": fmt.Sprintf("udp and port %d", s.port), "timeout_ms": timeoutMs, + // The default 256 MB ring can take seconds to allocate on a host + // short of free memory, longer than the tests wait for startup. + "buffer_size_mb": 8, // Test traffic and a zmq output both use 127.0.0.1; the default // output-host exclusion would filter all of it out of the capture. "not_filter_output_hosts": true, diff --git a/cpworker/tests/integration/testdata/reload/pipeline_dest_a.json b/cpworker/tests/integration/testdata/reload/pipeline_dest_a.json index c83f9f66..1936778b 100644 --- a/cpworker/tests/integration/testdata/reload/pipeline_dest_a.json +++ b/cpworker/tests/integration/testdata/reload/pipeline_dest_a.json @@ -4,7 +4,7 @@ "tasks": [ { "fingerprint": "dst-a", - "capturer": { "type": "libpcap", "libpcap": { "interface": "lo", "snaplen": 2048, "bpf": "udp and port 54321", "timeout_ms": 10 } }, + "capturer": { "type": "libpcap", "libpcap": { "interface": "lo", "snaplen": 2048, "bpf": "udp and port 54321", "timeout_ms": 10, "buffer_size_mb": 8 } }, "outputs": [ { "type": "file", "file": { "name": "testdata/output/reload/switch_pipeline/a.pcap" } } ] } ] diff --git a/cpworker/tests/integration/testdata/reload/pipeline_dest_b.json b/cpworker/tests/integration/testdata/reload/pipeline_dest_b.json index 33b5ee05..5d982f26 100644 --- a/cpworker/tests/integration/testdata/reload/pipeline_dest_b.json +++ b/cpworker/tests/integration/testdata/reload/pipeline_dest_b.json @@ -4,7 +4,7 @@ "tasks": [ { "fingerprint": "dst-b", - "capturer": { "type": "libpcap", "libpcap": { "interface": "lo", "snaplen": 2048, "bpf": "udp and port 54321", "timeout_ms": 10 } }, + "capturer": { "type": "libpcap", "libpcap": { "interface": "lo", "snaplen": 2048, "bpf": "udp and port 54321", "timeout_ms": 10, "buffer_size_mb": 8 } }, "outputs": [ { "type": "file", "file": { "name": "testdata/output/reload/switch_pipeline/b.pcap" } } ] } ] diff --git a/cpworker/tests/integration/testdata/reload/rtc_dest_a.json b/cpworker/tests/integration/testdata/reload/rtc_dest_a.json index 1abca73e..377c94e3 100644 --- a/cpworker/tests/integration/testdata/reload/rtc_dest_a.json +++ b/cpworker/tests/integration/testdata/reload/rtc_dest_a.json @@ -2,7 +2,7 @@ "tasks": [ { "fingerprint": "dst-a", - "capturer": { "type": "libpcap", "libpcap": { "interface": "lo", "snaplen": 2048, "bpf": "udp and port 54321", "timeout_ms": 10 } }, + "capturer": { "type": "libpcap", "libpcap": { "interface": "lo", "snaplen": 2048, "bpf": "udp and port 54321", "timeout_ms": 10, "buffer_size_mb": 8 } }, "outputs": [ { "type": "file", "file": { "name": "testdata/output/reload/switch_rtc/a.pcap" } } ] } ] diff --git a/cpworker/tests/integration/testdata/reload/rtc_dest_b.json b/cpworker/tests/integration/testdata/reload/rtc_dest_b.json index ccc066ba..c7c17301 100644 --- a/cpworker/tests/integration/testdata/reload/rtc_dest_b.json +++ b/cpworker/tests/integration/testdata/reload/rtc_dest_b.json @@ -2,7 +2,7 @@ "tasks": [ { "fingerprint": "dst-b", - "capturer": { "type": "libpcap", "libpcap": { "interface": "lo", "snaplen": 2048, "bpf": "udp and port 54321", "timeout_ms": 10 } }, + "capturer": { "type": "libpcap", "libpcap": { "interface": "lo", "snaplen": 2048, "bpf": "udp and port 54321", "timeout_ms": 10, "buffer_size_mb": 8 } }, "outputs": [ { "type": "file", "file": { "name": "testdata/output/reload/switch_rtc/b.pcap" } } ] } ]