Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b0d774b
feat(localdns): add systemd-based Prometheus metrics exporter
kwaksaewon Feb 20, 2026
781bd7d
add localdns-exporter.socket into vhdbuilder/packer/imagecustomizer/a…
kwaksaewon Feb 20, 2026
8f25956
perf(localdns): optimize forward IP metrics export using .prom file
kwaksaewon Feb 20, 2026
3667b29
test(localdns): add e2e test for metrics exporter validation
kwaksaewon Feb 20, 2026
84974ca
use posix-compliant equal sign
kwaksaewon Feb 23, 2026
970fcd0
only serve metrics at /metrics endpoint
kwaksaewon Feb 23, 2026
18290a9
improve logigng in parts/linux/cloud-init/artifacts/localdns_exporter.sh
kwaksaewon Feb 23, 2026
526ac5c
fix(localdns): use printf for HTTP headers with proper CRLF termination
kwaksaewon Feb 25, 2026
a971dbf
feat(localdns): support multiple forward IPs in metrics export
kwaksaewon Feb 25, 2026
f4d2ff1
refactor(localdns): use systemctl is-active for service status check
kwaksaewon Feb 25, 2026
10cf746
fix(localdns): remove redundant dependencies from socket-activated se…
kwaksaewon Feb 25, 2026
06d759b
test(localdns): add test cases for multiple forward IPs in metrics
kwaksaewon Feb 25, 2026
a5e7e42
fix(e2e): correct metrics endpoint path in test-localdns-exporter.sh
kwaksaewon Feb 25, 2026
2809a83
test(localdns): add unit tests for localdns_exporter.sh HTTP routing
kwaksaewon Feb 25, 2026
84029aa
fix(localdns): handle client disconnect gracefully in exporter script
kwaksaewon Feb 25, 2026
90cedb8
fix(e2e): remove invalid HTTP header check from metrics validation
kwaksaewon Feb 25, 2026
87a4222
fix(e2e): handle multiple forward IPs in metrics validation
kwaksaewon Feb 25, 2026
2adeb0a
feat(e2e): add explicit HTTP status code validation for metrics endpoint
kwaksaewon Feb 25, 2026
77bca0e
rename file to be snake-case
kwaksaewon Feb 25, 2026
fcec432
delete localdns-exporter.socket from vhdbuilder/packer/imagecustomize…
kwaksaewon Feb 25, 2026
9efb467
fix(e2e): align status value validation with actual producer output
kwaksaewon Feb 25, 2026
bc98787
feat(localdns): enable systemd resource accounting for metrics
kwaksaewon Feb 25, 2026
2daedaf
fix(localdns): bind metrics exporter socket to localhost only
kwaksaewon Feb 26, 2026
b9f9f3d
fix(e2e): filter metric grep to exclude HELP/TYPE comment lines
kwaksaewon Feb 26, 2026
a7c9a18
test(localdns): add /metrics endpoint coverage to exporter spec
kwaksaewon Feb 26, 2026
af2b2e7
fix(localdns): scope FORWARD_IPS_PROM_FILE as local variable
kwaksaewon Feb 26, 2026
8726825
security(localdns): run exporter as unprivileged DynamicUser
kwaksaewon Feb 26, 2026
b24e2ca
security(localdns): add IP-based access controls to exporter socket
kwaksaewon Feb 26, 2026
974c9a5
refactor(localdns): remove unnecessary exit from forward IP parsing
kwaksaewon Feb 26, 2026
9410437
fix(localdns): use atomic write for forward_ips.prom file
kwaksaewon Feb 26, 2026
f24e9d9
test(e2e): add AzureLinuxV3 test for localdns exporter metrics
kwaksaewon Feb 26, 2026
6ab3a2e
test(e2e): add Flatcar test for localdns exporter metrics
kwaksaewon Feb 26, 2026
a5bca10
fix(e2e): remove -p flag from ss command to avoid permission errors
kwaksaewon Feb 26, 2026
30b08bd
fix(e2e): prevent curl failures from exiting script early
kwaksaewon Feb 26, 2026
9cf87b4
fix(localdns): enable exporter socket conditionally during CSE
kwaksaewon Feb 26, 2026
d3b51bf
perf(localdns): use non-blocking start for exporter socket
kwaksaewon Feb 28, 2026
97f3ed5
test(localdns): add security hardening validation to e2e tests
kwaksaewon Feb 28, 2026
05283c7
improve(test): enhance security hardening validation
kwaksaewon Feb 28, 2026
980d491
refactor(e2e): organize localdns test scripts into subdirectory
kwaksaewon Feb 28, 2026
2525ad8
test(e2e): add localdns exporter tests for all supported distros
kwaksaewon Feb 28, 2026
07cbd62
refactor(e2e): extract localdns metrics validation script using go:embed
kwaksaewon Feb 28, 2026
1965390
refactor(e2e): remove redundant manual test script
kwaksaewon Feb 28, 2026
830b342
fix(localdns): filter non-IP tokens when parsing forward IPs from cor…
kwaksaewon Feb 28, 2026
4f77790
refactor(localdns): remove redundant IPAddress directives from socket…
kwaksaewon Feb 28, 2026
9d2f6fe
Merge remote-tracking branch 'origin/main' into sakwa/add_localdns_me…
kwaksaewon Feb 28, 2026
1c7bb9c
chore: regenerate testdata and fix shellcheck warning
kwaksaewon Feb 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions e2e/localdns/run-localdns-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
# Helper script to run localdns e2e tests
# Usage: ./run-localdns-test.sh [test-name]
# Examples:
# ./run-localdns-test.sh # Run the test specified in .env
# ./run-localdns-test.sh Test_Ubuntu2204_LocalDNSHostsPlugin
# ./run-localdns-test.sh Test_Ubuntu2404_LocalDNSHostsPlugin

set -euo pipefail

cd "$(dirname "$0")"

# Load .env file if it exists
if [ -f .env ]; then
echo "Loading configuration from .env..."
set -a
source .env
set +a
fi

# If test name is provided as argument, override TAGS_TO_RUN
if [ $# -gt 0 ]; then
export TAGS_TO_RUN="name=$1"
echo "Running specific test: $1"
else
echo "Running test(s) from .env: ${TAGS_TO_RUN:-all tests}"
fi

# Set defaults
: "${TIMEOUT:=90m}"
: "${PARALLEL:=100}"

echo ""
echo "=========================================="
echo "LocalDNS E2E Test Configuration"
echo "=========================================="
echo "Subscription: ${SUBSCRIPTION_ID:-not set}"
echo "Location: ${E2E_LOCATION:-westus3}"
echo "Tags to run: ${TAGS_TO_RUN:-all}"
echo "Tags to skip: ${TAGS_TO_SKIP:-none}"
echo "Keep VMSS: ${KEEP_VMSS:-false}"
echo "Timeout: ${TIMEOUT}"
echo "Parallel: ${PARALLEL}"
echo "=========================================="
echo ""

# Run the tests
echo "Starting e2e tests..."
go test -parallel $PARALLEL -timeout $TIMEOUT -v -count 1

Comment on lines +49 to +50
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script calls go test without specifying any test filter or package path. Without arguments, go test will test the current directory package. However, this script is meant to run localdns-related e2e tests but doesn't specify which test to run unless TAGS_TO_RUN is set.

The script should specify the package path explicitly, e.g., go test -parallel $PARALLEL -timeout $TIMEOUT -v -count 1 . or provide better documentation about which directory this script should be run from.

Additionally, if TAGS_TO_RUN is set to filter by test name (e.g., "name=Test_Ubuntu2204LocalDns_ExporterMetrics"), the script should use the -run flag instead of or in addition to -tags. The current code sets TAGS_TO_RUN but doesn't pass it to the go test command.

Suggested change
go test -parallel $PARALLEL -timeout $TIMEOUT -v -count 1
# If TAGS_TO_RUN is set, use it to filter tests via -run
RUN_ARGS=()
if [ -n "${TAGS_TO_RUN:-}" ]; then
RUN_ARGS=(-run "$TAGS_TO_RUN")
fi
go test "${RUN_ARGS[@]}" -parallel "$PARALLEL" -timeout "$TIMEOUT" -v -count 1 .

Copilot uses AI. Check for mistakes.
echo ""
echo "=========================================="
echo "Test run completed!"
echo "=========================================="
if [ "${KEEP_VMSS:-false}" = "true" ]; then
echo ""
echo "⚠️ REMINDER: KEEP_VMSS=true is set!"
echo "⚠️ VMs were NOT deleted. Check scenario-logs/ for SSH keys."
echo "⚠️ Don't forget to clean up resources to avoid costs:"
echo ""
echo " az group list --query \"[?starts_with(name, 'abe2e-')].name\" -o tsv"
echo " az group delete --name <resource-group-name> --yes --no-wait"
echo ""
fi
Loading
Loading