PRE-RELEASE v0.8.2

This commit is contained in:
2026-04-19 22:34:30 +02:00
parent 7ed77f5b22
commit 4b1b412fb7
7 changed files with 475 additions and 14 deletions

View File

@@ -49,9 +49,16 @@ Shared-listen-include across multiple server blocks
Length Should Be ${count} 2
... Expected 2 listening sockets on port 8080 (v4+v6 wildcards); got ${count}
# Proves the cross-cscf option-stripping path actually fired for
# the 2nd and 3rd server blocks. `nginx -t` replays the whole
# config and emits the wrapper's NOTICE each time it strips.
Should Contain ${output} stripped socket options from duplicate listen
# the 2nd and 3rd server blocks at daemon startup — the wrapper
# logs a NOTICE per stripped listen via ngx_conf_log_error. We
# read the container's startup log rather than `nginx -t`'s
# output because nginx keeps the config-parse log level at ERR
# until the error_log directive has been fully applied, so
# `nginx -t` suppresses the NOTICE even though the wrapper is
# invoked.
${rc} ${startup_log} = Run And Return Rc And Output
... docker logs ${SERVER} 2>&1
Should Contain ${startup_log} stripped socket options from duplicate listen
Prometheus scrape
[Documentation] Scrape returns HELP/TYPE preamble.
@@ -139,6 +146,53 @@ Duration histogram
Should Contain ${json} request_duration_ms
Should Contain ${json} buckets
# --- In-flight gauges ---
Gauge preamble in Prometheus output
[Documentation] The scrape preamble advertises the three gauge metric
... names and types. Present whether or not any traffic
... has ever been observed.
${output} = Scrape Prometheus
Should Match Regexp ${output} (?m)^# TYPE nginx_ipng_active gauge$
Should Match Regexp ${output} (?m)^# TYPE nginx_ipng_reading gauge$
Should Match Regexp ${output} (?m)^# TYPE nginx_ipng_writing gauge$
Gauges zero at rest
[Documentation] After the earlier traffic tests have drained and the
... flush tick has run, the in-flight gauges for (tag1,
... 10.0.1.1) must all report zero — no request is still
... resident in the plugin's per-request ctx.
Wait For Flush
${output} = Scrape With Filter source_tag=tag1&vip=10.0.1.1
Should Match Regexp ${output} nginx_ipng_active\\{[^}]*\\}\\s+0\\b
Should Match Regexp ${output} nginx_ipng_reading\\{[^}]*\\}\\s+0\\b
Should Match Regexp ${output} nginx_ipng_writing\\{[^}]*\\}\\s+0\\b
Gauges appear in JSON output
[Documentation] Each record in the JSON output carries a gauges object
... with active/reading/writing keys.
${rc} ${output} = Run And Return Rc And Output
... curl -sf -H 'Accept: application/json' '${SCRAPE_URL}?source_tag=tag1&vip=10.0.1.1' | python3 -m json.tool
Should Be Equal As Integers ${rc} 0
Should Contain ${output} "gauges"
Should Contain ${output} "active"
Should Contain ${output} "reading"
Should Contain ${output} "writing"
Gauges observed non-zero under concurrent load
[Documentation] Fire a burst of concurrent requests against the
... /slow backend (50 ms each, single-threaded) and
... observe at least one of active/reading/writing
... going non-zero for (tag1, 10.0.1.1) while the
... burst is in flight. After it drains the gauges
... return to zero. Uses 20 requests (drain <= ~2s
... given the single-threaded backend) to keep the
... test fast but still wide enough for the scrape
... to catch overlap.
Run docker exec -d ${CLIENT1} sh -c 'for i in $(seq 20); do curl -sf http://10.0.1.1:8080/slow >/dev/null & done; wait'
Wait Until Keyword Succeeds 5s 50ms Nonzero Gauge Observed tag1 10.0.1.1
Wait Until Keyword Succeeds 15s 500ms Gauges Drained tag1 10.0.1.1
# --- Scrape filters ---
Filter by source_tag
@@ -347,6 +401,26 @@ Get Request Count
END
RETURN ${total}
Nonzero Gauge Observed
[Documentation] Fails unless the scrape shows a non-zero value for at
... least one of {active, reading, writing} on the given
... (source_tag, vip) pair.
[Arguments] ${source} ${vip}
${output} = Scrape With Filter source_tag=${source}&vip=${vip}
Should Match Regexp ${output}
... nginx_ipng_(active|reading|writing)\\{[^}]*\\}\\s+[1-9]\\d*
Gauges Drained
[Documentation] Fails unless all three gauges are exactly zero for
... the given (source_tag, vip) pair. Use with Wait
... Until Keyword Succeeds to poll until a request burst
... has fully finalized.
[Arguments] ${source} ${vip}
${output} = Scrape With Filter source_tag=${source}&vip=${vip}
Should Match Regexp ${output} nginx_ipng_active\\{[^}]*\\}\\s+0\\b
Should Match Regexp ${output} nginx_ipng_reading\\{[^}]*\\}\\s+0\\b
Should Match Regexp ${output} nginx_ipng_writing\\{[^}]*\\}\\s+0\\b
# --- Container helpers ---
Docker Exec