Skip to content

Commit

Permalink
auto-merge envoyproxy/envoy[main] into envoyproxy/envoy-openssl[main]
Browse files Browse the repository at this point in the history
* upstream/main:
  mobile: Mark the BidirectionalStreamTest as flaky (#36391)
  mobile: Fix the thread priority expectation in InternalEngineTest (#36390)
  srds: minor perf: move scoped_route_config to ScopedRouteInfo (#36270)
  • Loading branch information
sync-envoy[bot] committed Sep 30, 2024
2 parents cd50f2d + 8772930 commit fc8f052
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions mobile/test/common/internal_engine_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ TEST_F(ThreadPriorityInternalEngineTest, SetThreadPriority) {
}

TEST_F(ThreadPriorityInternalEngineTest, SetOutOfRangeThreadPriority) {
// 42 is outside the range of acceptable thread priorities.
const int expected_thread_priority = 42;
// 102 is outside the range of acceptable thread priorities on all platforms.
const int expected_thread_priority = 102;
const int actual_thread_priority = startEngineWithPriority(expected_thread_priority);
// The `setpriority` system call doesn't define what happens when the thread priority is out of
// range, and the behavior could be system dependent. On Linux, if the supplied priority value
Expand Down
1 change: 1 addition & 0 deletions mobile/test/java/org/chromium/net/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ envoy_mobile_android_test(
srcs = [
"BidirectionalStreamTest.java",
],
flaky = True, # TODO(fredyw): Debug the reason for it being flaky.
native_deps = [
"//test/jni:libenvoy_jni_with_test_extensions.so",
] + select({
Expand Down
6 changes: 3 additions & 3 deletions source/common/router/scoped_config_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ HeaderValueExtractorImpl::computeFragment(const Http::HeaderMap& headers) const
return nullptr;
}

ScopedRouteInfo::ScopedRouteInfo(envoy::config::route::v3::ScopedRouteConfiguration config_proto,
ScopedRouteInfo::ScopedRouteInfo(envoy::config::route::v3::ScopedRouteConfiguration&& config_proto,
ConfigConstSharedPtr route_config)
: config_proto_(config_proto), route_config_(route_config),
config_hash_(MessageUtil::hash(config_proto)) {
: config_proto_(std::move(config_proto)), route_config_(route_config),
config_hash_(MessageUtil::hash(config_proto_)) {
// TODO(stevenzzzz): Maybe worth a KeyBuilder abstraction when there are more than one type of
// Fragment.
for (const auto& fragment : config_proto_.key().fragments()) {
Expand Down
6 changes: 3 additions & 3 deletions source/common/router/scoped_config_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ScopeKeyBuilderImpl : public ScopeKeyBuilderBase {
// ScopedRouteConfiguration and corresponding RouteConfigProvider.
class ScopedRouteInfo {
public:
ScopedRouteInfo(envoy::config::route::v3::ScopedRouteConfiguration config_proto,
ScopedRouteInfo(envoy::config::route::v3::ScopedRouteConfiguration&& config_proto,
ConfigConstSharedPtr route_config);

const ConfigConstSharedPtr& routeConfig() const { return route_config_; }
Expand All @@ -89,9 +89,9 @@ class ScopedRouteInfo {
uint64_t configHash() const { return config_hash_; }

private:
envoy::config::route::v3::ScopedRouteConfiguration config_proto_;
const envoy::config::route::v3::ScopedRouteConfiguration config_proto_;
ScopeKey scope_key_;
ConfigConstSharedPtr route_config_;
const ConfigConstSharedPtr route_config_;
const uint64_t config_hash_;
};
using ScopedRouteInfoConstSharedPtr = std::shared_ptr<const ScopedRouteInfo>;
Expand Down
2 changes: 1 addition & 1 deletion source/common/router/scoped_rds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ makeScopedRouteInfos(ProtobufTypes::ConstMessagePtrVector&& config_protos,
config_provider_manager.routeConfigProviderManager().createStaticRouteConfigProvider(
scoped_route_config.route_configuration(), factory_context,
factory_context.messageValidationContext().staticValidationVisitor());
scopes.push_back(std::make_shared<const ScopedRouteInfo>(scoped_route_config,
scopes.push_back(std::make_shared<const ScopedRouteInfo>(std::move(scoped_route_config),
route_config_provider->configCast()));
}

Expand Down
16 changes: 10 additions & 6 deletions test/common/router/scoped_config_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,19 +384,23 @@ TEST_F(ScopedRouteInfoTest, Creation) {

// Tests that config hash changes if ScopedRouteConfiguration of the ScopedRouteInfo changes.
TEST_F(ScopedRouteInfoTest, Hash) {
const envoy::config::route::v3::ScopedRouteConfiguration config_copy = scoped_route_config_;
info_ = std::make_unique<ScopedRouteInfo>(scoped_route_config_, route_config_);
envoy::config::route::v3::ScopedRouteConfiguration scoped_route_config1 = scoped_route_config_;
info_ = std::make_unique<ScopedRouteInfo>(std::move(scoped_route_config1), route_config_);
EXPECT_EQ(info_->routeConfig().get(), route_config_.get());
EXPECT_TRUE(TestUtility::protoEqual(info_->configProto(), config_copy));
EXPECT_TRUE(TestUtility::protoEqual(info_->configProto(), scoped_route_config_));
EXPECT_EQ(info_->scopeName(), "foo_scope");
EXPECT_EQ(info_->scopeKey(), makeKey({"foo", "bar"}));

const auto info2 = std::make_unique<ScopedRouteInfo>(scoped_route_config_, route_config_);
envoy::config::route::v3::ScopedRouteConfiguration scoped_route_config2 = scoped_route_config_;
const auto info2 =
std::make_unique<ScopedRouteInfo>(std::move(scoped_route_config2), route_config_);
ASSERT_EQ(info2->configHash(), info_->configHash());

// Mutate the config and hash should be different now.
scoped_route_config_.set_on_demand(true);
const auto info3 = std::make_unique<ScopedRouteInfo>(scoped_route_config_, route_config_);
envoy::config::route::v3::ScopedRouteConfiguration scoped_route_config3 = scoped_route_config_;
scoped_route_config3.set_on_demand(true);
const auto info3 =
std::make_unique<ScopedRouteInfo>(std::move(scoped_route_config3), route_config_);
ASSERT_NE(info3->configHash(), info_->configHash());
}

Expand Down

0 comments on commit fc8f052

Please sign in to comment.