Skip to content

Commit

Permalink
fix tests: add expectations for tracing headers
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed May 29, 2024
1 parent 041c9a7 commit 8371049
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/rate_limited.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ fn it_loads() {
module
.call_proxy_on_request_headers(http_context, 0, false)
.expect_log(Some(LogLevel::Info), Some("on_http_request_headers #2"))
.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 @@ -155,6 +161,12 @@ fn it_limits() {
module
.call_proxy_on_request_headers(http_context, 0, false)
.expect_log(Some(LogLevel::Info), Some("on_http_request_headers #2"))
.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"]))
Expand Down Expand Up @@ -283,6 +295,12 @@ fn it_passes_additional_headers() {
module
.call_proxy_on_request_headers(http_context, 0, false)
.expect_log(Some(LogLevel::Info), Some("on_http_request_headers #2"))
.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"]))
Expand Down Expand Up @@ -405,6 +423,12 @@ fn it_rate_limits_with_empty_conditions() {
module
.call_proxy_on_request_headers(http_context, 0, false)
.expect_log(Some(LogLevel::Info), Some("on_http_request_headers #2"))
.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_grpc_call(
Expand Down Expand Up @@ -506,6 +530,12 @@ 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::Info), Some("on_http_request_headers #2"))
.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 8371049

Please sign in to comment.