Full implementation of the nginx dynamic module with: - SO_BINDTODEVICE-based per-interface traffic attribution - Per-worker lock-free counters flushed to shared memory - Prometheus text and JSON scrape endpoint at configurable location - UDP-only global logtail (ipng_stats_logtail) for fire-and-forget access log streaming - $ipng_source_tag nginx variable for use in log_format/map - Histogram buckets, EWMA rate gauges, zone meta-metrics - Debian packaging (libnginx-mod-http-ipng-stats) - Robot Framework end-to-end tests via containerlab - SPDX Apache-2.0 headers on all source files
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
# Test runner for nginx-ipng-stats-plugin robot tests.
|
|
# Usage: ./rf-run.sh <runtime> <test_path>
|
|
# runtime: docker (default)
|
|
# test_path: path to .robot file or directory (default: all tests)
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
CLAB_BIN="${CLAB_BIN:-containerlab}"
|
|
RUNTIME="${1:-docker}"
|
|
TEST="${2:-${SCRIPT_DIR}}"
|
|
|
|
mkdir -p "${SCRIPT_DIR}/out"
|
|
|
|
# Create venv if needed
|
|
if [ ! -d "${SCRIPT_DIR}/.venv" ]; then
|
|
python3 -m venv "${SCRIPT_DIR}/.venv"
|
|
"${SCRIPT_DIR}/.venv/bin/pip" install -q -r "${SCRIPT_DIR}/requirements.txt"
|
|
fi
|
|
|
|
source "${SCRIPT_DIR}/.venv/bin/activate"
|
|
|
|
get_logname() {
|
|
local name
|
|
name="$(basename "$1" .robot)"
|
|
if [ -d "$1" ]; then
|
|
name="$(basename "$1")"
|
|
fi
|
|
echo "$name"
|
|
}
|
|
|
|
robot --consolecolors on -r none \
|
|
--variable CLAB_BIN:"${CLAB_BIN}" \
|
|
--variable runtime:"${RUNTIME}" \
|
|
-l "${SCRIPT_DIR}/out/$(get_logname "${TEST}")-${RUNTIME}-log" \
|
|
--output "${SCRIPT_DIR}/out/$(get_logname "${TEST}")-${RUNTIME}-out.xml" \
|
|
"${TEST}"
|