Skip to content
Closed
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
45 changes: 38 additions & 7 deletions bazel/googletest.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
From b217f1131adb21e2c1193782d2659ae03840659a Mon Sep 17 00:00:00 2001
From: Rohit Agrawal <[email protected]>
Date: Sat, 3 May 2025 00:29:17 +0900
Subject: [PATCH] Bazel Fixes

---
BUILD.bazel | 17 -----------------
1 file changed, 17 deletions(-)

diff --git a/BUILD.bazel b/BUILD.bazel
index 8099642a85..3598661079 100644
index 53501454ce..fff6e491e7 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -40,7 +40,7 @@ exports_files(["LICENSE"])

@@ -56,12 +56,6 @@ config_setting(
constraint_values = ["@platforms//os:openbsd"],
)

-# NOTE: Fuchsia is not an officially supported platform.
-config_setting(
- name = "fuchsia",
- constraint_values = ["@platforms//os:fuchsia"],
-)
-
config_setting(
name = "windows",
- constraint_values = ["@bazel_tools//platforms:windows"],
+ constraint_values = ["@platforms//os:windows"],
name = "msvc_compiler",
flag_values = {
@@ -157,17 +151,6 @@ cc_library(
"@re2//:re2",
],
"//conditions:default": [],
- }) + select({
- # `gtest-death-test.cc` has `EXPECT_DEATH` that spawns a process,
- # expects it to crash and inspects its logs with the given matcher,
- # so that's why these libraries are needed.
- # Otherwise, builds targeting Fuchsia would fail to compile.
- ":fuchsia": [
- "@fuchsia_sdk//pkg/fdio",
- "@fuchsia_sdk//pkg/syslog",
- "@fuchsia_sdk//pkg/zx",
- ],
- "//conditions:default": [],
}),
)

config_setting(
4 changes: 4 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,10 @@ def _com_google_googletest():
"com_google_googletest",
patches = ["@envoy//bazel:googletest.patch"],
patch_args = ["-p1"],
repo_mapping = {
"@abseil-cpp": "@com_google_absl",
"@re2": "@com_googlesource_code_re2",
},
)

# TODO(jmarantz): replace the use of bind and external_deps with just
Expand Down
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -912,11 +912,11 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_url = "https://github.com/google/googletest",
# Pick up fix for MOCK_METHOD compilation with clang-cl for Windows (resolved after 1.10.0)
# see https://github.com/google/googletest/issues/2490
version = "a4ab0abb93620ce26efad9de9296b73b16e88588",
sha256 = "7897bfaa5ad39a479177cfb5c3ce010184dbaee22a7c3727b212282871918751",
version = "52eb8108c5bdec04579160ae17225d66034bd723",
sha256 = "745c55415660044610f7fcd3af7a6420d5de16a7dbb9ebfe2e131275676232be",
strip_prefix = "googletest-{version}",
urls = ["https://github.com/google/googletest/archive/{version}.tar.gz"],
release_date = "2020-09-10",
release_date = "2025-04-30",
use_category = ["test_only"],
cpe = "cpe:2.3:a:google:google_test:*",
license = "BSD-3-Clause",
Expand Down
15 changes: 15 additions & 0 deletions test/common/http/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ envoy_cc_test(
# Split to avoid compiler OOM, especially on ASAN.
"conn_manager_impl_test.cc",
"conn_manager_impl_test_2.cc",
"conn_manager_impl_test_3.cc",
],
rbe_pool = "2core",
shard_count = 5,
Expand All @@ -305,6 +306,20 @@ envoy_cc_test(
],
)

envoy_cc_test(
name = "conn_manager_misc_test",
srcs = ["conn_manager_misc_test.cc"],
rbe_pool = "2core",
shard_count = 5,
deps = [
":conn_manager_impl_test_base_lib",
":custom_header_extension_lib",
"//envoy/network:proxy_protocol_options_lib",
"//test/extensions/filters/network/common/fuzz/utils:network_filter_fuzzer_fakes_lib",
"//test/server:utility_lib",
],
)

envoy_cc_test(
name = "conn_manager_utility_test",
srcs = ["conn_manager_utility_test.cc"],
Expand Down
5 changes: 4 additions & 1 deletion test/common/http/codec_impl_fuzz_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
#include "quiche/common/platform/api/quiche_test.h"

using testing::_;
using testing::AnyNumber;
using testing::Between;
using testing::Invoke;
using testing::InvokeWithoutArgs;
using testing::Return;

namespace Envoy {
namespace Http {
Expand Down Expand Up @@ -427,7 +430,7 @@ class HttpStream : public LinkedObject<HttpStream> {
[&] { directionalAction(response_, stream_action.dispatching_action()); }));
} else if (request_action == test::common::http::DirectionalAction::kData) {
EXPECT_CALL(request_.request_decoder_, decodeData(_, _))
.Times(testing::AtLeast(1))
.Times(AnyNumber())
.WillRepeatedly(InvokeWithoutArgs([&] {
// Only simulate response action if the stream action is active
// otherwise the expectation could trigger in other moments
Expand Down
83 changes: 0 additions & 83 deletions test/common/http/conn_manager_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include "test/test_common/logging.h"
#include "test/test_common/test_runtime.h"

#include "conn_manager_impl_test_base.h"

using testing::_;
using testing::An;
using testing::AnyNumber;
Expand Down Expand Up @@ -2715,87 +2713,6 @@ TEST_F(HttpConnectionManagerImplTest, TestPeriodicAccessLogging) {
filter->callbacks_->encodeHeaders(std::move(response_headers), true, "details");
}

class StreamErrorOnInvalidHttpMessageTest : public HttpConnectionManagerImplTest {
public:
void sendInvalidRequestAndVerifyConnectionState(bool stream_error_on_invalid_http_message,
bool send_complete_request = true) {
setup();

EXPECT_CALL(*codec_, dispatch(_))
.WillRepeatedly(Invoke([&](Buffer::Instance& data) -> Http::Status {
decoder_ = &conn_manager_->newStream(response_encoder_);

// These request headers are missing the necessary ":host"
RequestHeaderMapPtr headers{
new TestRequestHeaderMapImpl{{":method", "GET"}, {":path", "/"}}};
decoder_->decodeHeaders(std::move(headers), send_complete_request);
data.drain(0);
return Http::okStatus();
}));

auto* filter = new MockStreamFilter();
EXPECT_CALL(filter_factory_, createFilterChain(_))
.WillOnce(Invoke([&](FilterChainManager& manager) -> bool {
auto factory = createStreamFilterFactoryCb(StreamFilterSharedPtr{filter});
manager.applyFilterFactoryCb({}, factory);
return true;
}));
EXPECT_CALL(*filter, setDecoderFilterCallbacks(_));
EXPECT_CALL(*filter, setEncoderFilterCallbacks(_));

// codec stream error
EXPECT_CALL(response_encoder_, streamErrorOnInvalidHttpMessage())
.WillOnce(Return(stream_error_on_invalid_http_message));
EXPECT_CALL(*filter, encodeComplete());
EXPECT_CALL(*filter, encodeHeaders(_, true));
if (!stream_error_on_invalid_http_message) {
EXPECT_CALL(filter_callbacks_.connection_, close(_)).Times(AnyNumber());
if (send_complete_request) {
// The request is complete, so we should not flush close.
EXPECT_CALL(filter_callbacks_.connection_, close(Network::ConnectionCloseType::FlushWrite))
.Times(AnyNumber());
} else {
// If the request isn't complete, avoid a FIN/RST race with delay close.
EXPECT_CALL(filter_callbacks_.connection_,
close(Network::ConnectionCloseType::FlushWriteAndDelay))
.Times(AnyNumber());
}
}
EXPECT_CALL(response_encoder_, encodeHeaders(_, true))
.WillOnce(Invoke([&](const ResponseHeaderMap& headers, bool) -> void {
EXPECT_EQ("400", headers.getStatusValue());
EXPECT_EQ("missing_host_header",
filter->decoder_callbacks_->streamInfo().responseCodeDetails().value());
if (!stream_error_on_invalid_http_message) {
EXPECT_NE(nullptr, headers.Connection());
EXPECT_EQ("close", headers.getConnectionValue());
} else {
EXPECT_EQ(nullptr, headers.Connection());
}
}));

EXPECT_CALL(*filter, onStreamComplete());
EXPECT_CALL(*filter, onDestroy());

Buffer::OwnedImpl fake_input;
conn_manager_->onData(fake_input, false);
}
};

TEST_F(StreamErrorOnInvalidHttpMessageTest, ConnectionTerminatedIfCodecStreamErrorIsFalse) {
sendInvalidRequestAndVerifyConnectionState(false);
}

TEST_F(StreamErrorOnInvalidHttpMessageTest,
ConnectionTerminatedWithDelayIfCodecStreamErrorIsFalse) {
// Same as above, only with an incomplete request.
sendInvalidRequestAndVerifyConnectionState(false, false);
}

TEST_F(StreamErrorOnInvalidHttpMessageTest, ConnectionOpenIfCodecStreamErrorIsTrue) {
sendInvalidRequestAndVerifyConnectionState(true);
}

TEST_F(HttpConnectionManagerImplTest, TestAccessLogSsl) {
setup(SetupOpts().setSsl(true));

Expand Down
Loading