Skip to content

Commit

Permalink
Fix tests using header resolver
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Cattermole <[email protected]>
  • Loading branch information
adam-cattermole committed Aug 28, 2024
1 parent 760c9b2 commit 18d94e4
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions tests/rate_limited.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ fn it_loads() {
module
.call_proxy_on_request_headers(http_context, 0, false)
.expect_log(Some(LogLevel::Debug), Some("#2 on_http_request_headers"))
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("traceparent"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("tracestate"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("baggage"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":authority"))
.returning(Some("cars.toystore.com"))
.expect_log(
Expand Down Expand Up @@ -161,14 +155,14 @@ fn it_limits() {
module
.call_proxy_on_request_headers(http_context, 0, false)
.expect_log(Some(LogLevel::Debug), Some("#2 on_http_request_headers"))
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":authority"))
.returning(Some("cars.toystore.com"))
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("traceparent"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("tracestate"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("baggage"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":authority"))
.returning(Some("cars.toystore.com"))
.expect_get_property(Some(vec!["request", "url_path"]))
.returning(Some("/admin/toy".as_bytes()))
.expect_get_property(Some(vec!["request", "host"]))
Expand Down Expand Up @@ -299,14 +293,14 @@ fn it_passes_additional_headers() {
module
.call_proxy_on_request_headers(http_context, 0, false)
.expect_log(Some(LogLevel::Debug), Some("#2 on_http_request_headers"))
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":authority"))
.returning(Some("cars.toystore.com"))
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("traceparent"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("tracestate"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("baggage"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":authority"))
.returning(Some("cars.toystore.com"))
.expect_get_property(Some(vec!["request", "url_path"]))
.returning(Some("/admin/toy".as_bytes()))
.expect_get_property(Some(vec!["request", "host"]))
Expand Down Expand Up @@ -431,14 +425,14 @@ fn it_rate_limits_with_empty_conditions() {
module
.call_proxy_on_request_headers(http_context, 0, false)
.expect_log(Some(LogLevel::Debug), Some("#2 on_http_request_headers"))
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":authority"))
.returning(Some("a.com"))
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("traceparent"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("tracestate"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("baggage"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":authority"))
.returning(Some("a.com"))
.expect_log(
Some(LogLevel::Debug),
Some("#2 ratelimitpolicy selected some-name"),
Expand Down Expand Up @@ -542,12 +536,6 @@ fn it_does_not_rate_limits_when_selector_does_not_exist_and_misses_default_value
module
.call_proxy_on_request_headers(http_context, 0, false)
.expect_log(Some(LogLevel::Debug), Some("#2 on_http_request_headers"))
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("traceparent"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("tracestate"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("baggage"))
.returning(None)
.expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":authority"))
.returning(Some("a.com"))
.expect_get_property(Some(vec!["unknown", "path"]))
Expand Down

0 comments on commit 18d94e4

Please sign in to comment.