Don't leave multiple threads hanging during testing#64
Merged
shaneutt merged 8 commits intopraxis-proxy:mainfrom Apr 22, 2026
Merged
Don't leave multiple threads hanging during testing#64shaneutt merged 8 commits intopraxis-proxy:mainfrom
shaneutt merged 8 commits intopraxis-proxy:mainfrom
Conversation
Signed-off-by: Ed Snible <snible@us.ibm.com>
Signed-off-by: Ed Snible <snible@us.ibm.com>
Signed-off-by: Ed Snible <snible@us.ibm.com>
Signed-off-by: Ed Snible <snible@us.ibm.com>
Signed-off-by: Ed Snible <snible@us.ibm.com>
Signed-off-by: Ed Snible <snible@us.ibm.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Rust integration-test utilities and test suites to avoid leaking background threads/resources by introducing RAII guards for spawned proxy/backend servers and updating tests to hold those guards for the test lifetime.
Changes:
- Introduce
ProxyGuard(Pingora server shutdown on drop) andBackendGuard(TCP backend shutdown on drop) intests/utils. - Add new
*_with_shutdownbackend helpers and update many tests to use guards andproxy.addr()instead of raw address strings. - Update
tests/utilscrate dependencies to support Pingora shutdown signaling (pingora-core,async-trait,tokio/sync).
Reviewed changes
Copilot reviewed 111 out of 112 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/src/proxy.rs | Add ProxyGuard and spawn helper using Pingora shutdown signal watch. |
| tests/utils/src/net/mod.rs | Re-export new backend guard helpers. |
| tests/utils/src/net/backend/specialized.rs | Add BackendGuard and spawn_tcp_server_with_shutdown. |
| tests/utils/src/net/backend/simple.rs | Add Backend::start_with_shutdown and start_backend_with_shutdown. |
| tests/utils/src/net/backend/mod.rs | Re-export BackendGuard and new *_with_shutdown helpers. |
| tests/utils/src/net/backend/echo.rs | Add echo backends that return BackendGuard. |
| tests/utils/src/lib.rs | Re-export ProxyGuard from test utils crate. |
| tests/utils/Cargo.toml | Add async-trait, pingora-core, and enable tokio/sync. |
| tests/smoke/tests/suite/smoke.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/security/tests/suite/request_smuggling.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/security/tests/suite/ip_acl.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/security/tests/suite/info_leakage.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/security/tests/suite/host_header.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/security/tests/suite/header_injection.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/security/tests/suite/forwarded_headers.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/security/tests/suite/filter_leakage.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/resilience/tests/suite/throughput_simple.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/resilience/tests/suite/throughput_production.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/resilience/tests/suite/throughput_filter_chain.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/resilience/tests/suite/throughput_body.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/resilience/tests/suite/rate_limit_burst.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/resilience/tests/suite/multi_listener_isolation.rs | Keep proxy alive via _proxy guard binding. |
| tests/resilience/tests/suite/large_payload.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/resilience/tests/suite/concurrent_load.rs | Hold ProxyGuard; clone proxy.addr() for threads. |
| tests/resilience/tests/suite/backend_recovery.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/resilience/tests/suite/backend_failure.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/integration/tests/suite/url_rewrite.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/tcp_access_log.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/security.rs | Use header-echo backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/routing/path_based.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/routing/listeners.rs | Use backend shutdown helpers and keep proxy alive via guard. |
| tests/integration/tests/suite/routing/infrastructure.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/routing/host_based.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/routing/filters.rs | Use backend shutdown helpers and ProxyGuard for custom registry case. |
| tests/integration/tests/suite/routing/basic.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/retry.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/rate_limit.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/per_listener_pipeline.rs | Use backend shutdown helper and keep proxy alive via guard. |
| tests/integration/tests/suite/path_rewrite.rs | Use URI-echo backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/json_body_field.rs | Use header-echo backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/ip_acl.rs | Use backend shutdown helpers and keep proxy alive via guard. |
| tests/integration/tests/suite/health_check.rs | Use backend shutdown helper for stable backend in health-check tests. |
| tests/integration/tests/suite/filter_composition.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/examples/weighted_load_balancing.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/examples/virtual_hosts.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/examples/timeout.rs | Use backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/examples/stream_buffer.rs | Return (BackendGuard, ProxyGuard) from setup; use guards in tests. |
| tests/integration/tests/suite/examples/static_response.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/integration/tests/suite/examples/session_affinity.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/examples/round_robin.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/examples/redirect.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/integration/tests/suite/examples/path_rewriting.rs | Use URI-echo backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/examples/path_based_routing.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/examples/multi_listener.rs | Use backend shutdown helpers (multi-listener example). |
| tests/integration/tests/suite/examples/model_to_header.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/examples/max_body_guard.rs | Use backend shutdown helper and ProxyGuard for registry-based proxy. |
| tests/integration/tests/suite/examples/logging.rs | Use backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/examples/least_connections.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/examples/header_manipulation.rs | Use backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/examples/default_config.rs | Hold ProxyGuard and use proxy.addr(). |
| tests/integration/tests/suite/examples/conditional_filters.rs | Use backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/examples/canary_routing.rs | Use backend shutdown helpers and ProxyGuard. |
| tests/integration/tests/suite/examples/basic_reverse_proxy.rs | Use backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/examples/api_key_filter.rs | Use backend shutdown helper and ProxyGuard for registry-based proxy. |
| tests/integration/tests/suite/examples/access_logging.rs | Use backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/downstream_read_timeout.rs | Use backend shutdown helper and ProxyGuard (including raw TCP connect). |
| tests/integration/tests/suite/conditions.rs | Use header-echo backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/compression.rs | Use backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/adversarial/rate_limit_bypass.rs | Use backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/adversarial/path_traversal.rs | Use URI-echo backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/adversarial/ipv6_bypass.rs | Use backend shutdown helper and ProxyGuard for v4/v6 cases. |
| tests/integration/tests/suite/adversarial/host_header.rs | Use backend shutdown helper and ProxyGuard. |
| tests/integration/tests/suite/adversarial/header_smuggling.rs | Use backend/header-echo shutdown helpers and ProxyGuard. |
| tests/conformance/tests/suite/tls.rs | Update TLS proxy helpers to return/hold ProxyGuard. |
| tests/conformance/tests/suite/rfcs/rfc9113.rs | Use ProxyGuard and proxy.addr() for HTTP/2 conformance tests. |
| tests/conformance/tests/suite/rfcs/rfc7239.rs | Use ProxyGuard and update wrapper to return ProxyGuard. |
| tests/conformance/tests/suite/rfcs/rfc6265.rs | Use ProxyGuard and proxy.addr(). |
| tests/conformance/tests/suite/ipv6.rs | Use ProxyGuard and proxy.addr() for v6 tests. |
| tests/conformance/tests/suite/h2spec.rs | Use ProxyGuard and proxy.addr() before invoking h2spec. |
| tests/conformance/tests/suite/cors.rs | Use ProxyGuard and proxy.addr(). |
| tests/conformance/tests/suite/chunked.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/transformation/header_manipulation.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/traffic_management/weighted_load_balancing.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/traffic_management/virtual_hosts.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/traffic_management/timeout.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/traffic_management/static_response.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/traffic_management/session_affinity.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/traffic_management/round_robin.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/traffic_management/path_based_routing.rs | Use ProxyGuard and proxy.addr() (retry variant). |
| tests/configuration/tests/suite/examples/traffic_management/least_connections.rs | Use ProxyGuard and proxy.addr() (incl. concurrent case). |
| tests/configuration/tests/suite/examples/traffic_management/canary_routing.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/traffic_management/basic_reverse_proxy.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/pipeline/default_config.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/pipeline/conditional_filters.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/payload_processing/stream_buffer.rs | Update to ProxyGuard usage (but backend still starts without shutdown guard). |
| tests/configuration/tests/suite/examples/observability/logging.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/observability/access_logging.rs | Use ProxyGuard and proxy.addr(). |
| tests/configuration/tests/suite/examples/max_body_guard.rs | Use ProxyGuard and proxy.addr() for registry-based proxy. |
| tests/configuration/tests/suite/examples/api_key_filter.rs | Use ProxyGuard and proxy.addr() for registry-based proxy. |
| tests/configuration/tests/suite/examples/ai/model_to_header.rs | Use ProxyGuard and pass proxy.addr() into http_post. |
| Cargo.lock | Add/adjust dependencies due to new tests/utils requirements. |
shaneutt
previously requested changes
Apr 22, 2026
Signed-off-by: Ed Snible <snible@us.ibm.com>
Member
|
Ignoring the PR size failure for this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #56
Many of the tests start threads that hold open resources and don't release them until the entire
cargo testterminates. This keeps the tests from running on the Mac and other resource-constrained environments.With these changes, all integration tests but one now pass on the Mac.
This PRs entire purpose is to shut down resources when each test exits. This should make the integration tests use less resources on any system. The changes aren't Mac-specific.