Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ void RawHttpClientImpl::check(RequestCallbacks& callbacks,
callbacks_ = nullptr;
span_ = nullptr;
} else {
span_->injectContext(message->headers());
request_ = cm_.httpAsyncClientForCluster(cluster).send(
std::move(message), *this,
Http::AsyncClient::RequestOptions().setTimeout(config_->timeout()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ TEST_F(ExtAuthzHttpClientTest, AuthorizationOk) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));

client_.check(request_callbacks_, request, active_span_);

Expand All @@ -257,6 +258,7 @@ TEST_F(ExtAuthzHttpClientTest, AuthorizationOkWithAddedAuthzHeaders) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));
// Expect that header1 will be added and header2 correctly overwritten.
EXPECT_CALL(async_client_, send_(AllOf(ContainsPairAsHeader(config_->headersToAdd().front()),
ContainsPairAsHeader(config_->headersToAdd().back())),
Expand Down Expand Up @@ -286,6 +288,7 @@ TEST_F(ExtAuthzHttpClientTest, AuthorizationOkWithAllowHeader) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));
client_.check(request_callbacks_, request, active_span_);

const auto check_response_headers =
Expand Down Expand Up @@ -315,6 +318,7 @@ TEST_F(ExtAuthzHttpClientTest, AuthorizationDenied) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));
client_.check(request_callbacks_, request, active_span_);

EXPECT_CALL(*child_span, setTag(Eq("ext_authz_status"), Eq("ext_authz_unauthorized")));
Expand All @@ -337,6 +341,7 @@ TEST_F(ExtAuthzHttpClientTest, AuthorizationDeniedWithAllAttributes) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));

envoy::service::auth::v2::CheckRequest request;
client_.check(request_callbacks_, request, active_span_);
Expand All @@ -362,6 +367,7 @@ TEST_F(ExtAuthzHttpClientTest, AuthorizationDeniedAndAllowedClientHeaders) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));

envoy::service::auth::v2::CheckRequest request;
client_.check(request_callbacks_, request, active_span_);
Expand All @@ -385,6 +391,7 @@ TEST_F(ExtAuthzHttpClientTest, AuthorizationRequestError) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));

client_.check(request_callbacks_, request, active_span_);

Expand All @@ -405,6 +412,8 @@ TEST_F(ExtAuthzHttpClientTest, AuthorizationRequest5xxError) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));

client_.check(request_callbacks_, request, active_span_);

EXPECT_CALL(request_callbacks_,
Expand All @@ -425,6 +434,7 @@ TEST_F(ExtAuthzHttpClientTest, AuthorizationRequestErrorParsingStatusCode) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));

client_.check(request_callbacks_, request, active_span_);

Expand All @@ -443,6 +453,7 @@ TEST_F(ExtAuthzHttpClientTest, CancelledAuthorizationRequest) {
EXPECT_CALL(active_span_, spawnChild_(_, config_->tracingName(), _)).WillOnce(Return(child_span));
EXPECT_CALL(*child_span,
setTag(Eq(Tracing::Tags::get().UpstreamCluster), Eq(config_->cluster())));
EXPECT_CALL(*child_span, injectContext(_));
EXPECT_CALL(async_client_, send_(_, _, _)).WillOnce(Return(&async_request_));
client_.check(request_callbacks_, request, active_span_);

Expand Down