@@ -47,6 +47,11 @@ assert_equal "$(sanitize_target_endpoint grpc://svc:50051)" "grpc://svc:50051" "
4747assert_equal " $( sanitize_client_max_body_size 50m) " " 50m" " sanitize_client_max_body_size accepts suffix"
4848assert_equal " $( sanitize_dns_label test_label) " " test_label" " sanitize_dns_label accepts lowercase"
4949assert_equal " $( sanitize_dns_label test-label) " " test-label" " sanitize_dns_label accepts hyphen"
50+ assert_equal " $( sanitize_proxy_timeout 30) " " 30" " sanitize_proxy_timeout accepts numeric value"
51+ assert_equal " $( sanitize_proxy_timeout 30s) " " 30s" " sanitize_proxy_timeout accepts seconds suffix"
52+ assert_equal " $( sanitize_proxy_timeout 5m) " " 5m" " sanitize_proxy_timeout accepts minutes suffix"
53+ assert_equal " $( sanitize_proxy_timeout 1h) " " 1h" " sanitize_proxy_timeout accepts hours suffix"
54+ assert_equal " $( sanitize_proxy_timeout ' ' ) " " " " sanitize_proxy_timeout accepts empty value"
5055
5156# Failing cases
5257assert_fails " sanitize_port rejects non-numeric" sanitize_port abc
6065 printf ' %s\n' " $warning_output "
6166 failures=$(( failures + 1 ))
6267fi
68+
69+ # Test invalid timeout values
70+ timeout_warning=" $( sanitize_proxy_timeout " 30ms" 2>&1 || true) "
71+ if [[ " $timeout_warning " == " Warning: Ignoring invalid proxy timeout value: 30ms" ]]; then
72+ echo " PASS: sanitize_proxy_timeout warns on invalid suffix (ms)"
73+ else
74+ echo " FAIL: sanitize_proxy_timeout warning unexpected"
75+ printf ' %s\n' " $timeout_warning "
76+ failures=$(( failures + 1 ))
77+ fi
78+
79+ timeout_warning=" $( sanitize_proxy_timeout " abc" 2>&1 || true) "
80+ if [[ " $timeout_warning " == " Warning: Ignoring invalid proxy timeout value: abc" ]]; then
81+ echo " PASS: sanitize_proxy_timeout warns on non-numeric value"
82+ else
83+ echo " FAIL: sanitize_proxy_timeout warning unexpected"
84+ printf ' %s\n' " $timeout_warning "
85+ failures=$(( failures + 1 ))
86+ fi
87+
6388assert_fails " sanitize_dns_label rejects invalid characters" sanitize_dns_label " bad*label"
6489
6590if [[ $failures -eq 0 ]]; then
0 commit comments