Skip to content

Commit

Permalink
Update Envoy to efd9bef (Mar 19, 2024) (#1099)
Browse files Browse the repository at this point in the history
- Update the `ENVOY_COMMIT` and `ENVOY_SHA` in `bazel/repositories.bzl` to the latest Envoy's commit.
- Update `source/client/process_impl.cc` to accommodate the new virtual functions created in envoyproxy/envoy@f4b2d4a.
- Update `source/client/process_impl.cc` to accommodate the change of the constructor of `source/common/tls/context_manager_impl.h` in envoyproxy/envoy@b7818b0.
- Update all the places that instantiate a `LoaderImpl` to accommodate the constructor change in envoyproxy/envoy@708fa7b.

Signed-off-by: jiajunye <jiajunye@google.com>
  • Loading branch information
jiajunye authored Mar 25, 2024
1 parent c49bed1 commit c50bfa1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 12 deletions.
4 changes: 2 additions & 2 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

ENVOY_COMMIT = "da1a7d2ed07c6c60e7e0b05430337465ed91a03e"
ENVOY_SHA = "a1c180a8710ff8df298bc04db6207e6055d2558dc0c26a93a6cbb85c0ab090ff"
ENVOY_COMMIT = "efd9bef80764663be31b115301812a5bb647fad5"
ENVOY_SHA = "424017e3dd804d3e0ec46aa84e009c413fb6a51ade43ac8339b5a73e1a5d3107"

HDR_HISTOGRAM_C_VERSION = "0.11.2" # October 12th, 2020
HDR_HISTOGRAM_C_SHA = "637f28b5f64de2e268131e4e34e6eef0b91cf5ff99167db447d9b2825eae6bad"
Expand Down
21 changes: 17 additions & 4 deletions source/client/process_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ class NighthawkServerInstance : public Envoy::Server::Instance {
void setSinkPredicates(std::unique_ptr<Envoy::Stats::SinkPredicates>&&) override {
PANIC("NighthawkServerInstance::setSinkPredicates not implemented");
}
Envoy::Regex::Engine& regexEngine() override {
PANIC("NighthawkServerInstance::regexEngine not implemented");
};

private:
Envoy::OptRef<Envoy::Server::Admin> admin_;
Expand Down Expand Up @@ -310,6 +313,10 @@ class NighthawkServerFactoryContext : public Envoy::Server::Configuration::Serve
PANIC("NighthawkServerFactoryContext::lifecycleNotifier not implemented");
};

Envoy::Regex::Engine& regexEngine() override {
PANIC("NighthawkServerFactoryContext::regexEngine not implemented");
};

Envoy::Init::Manager& initManager() override {
PANIC("NighthawkServerFactoryContext::initManager not implemented");
};
Expand Down Expand Up @@ -815,19 +822,25 @@ bool ProcessImpl::runInternal(OutputCollector& collector, const UriPtr& tracing_
}
tls_.registerThread(*dispatcher_, true);
store_root_.initializeThreading(*dispatcher_, tls_);
absl::Status creation_status;
runtime_loader_ = Envoy::Runtime::LoaderPtr{new Envoy::Runtime::LoaderImpl(
*dispatcher_, tls_, {}, *local_info_, store_root_, generator_,
Envoy::ProtobufMessage::getStrictValidationVisitor(), *api_)};
ssl_context_manager_ =
std::make_unique<Envoy::Extensions::TransportSockets::Tls::ContextManagerImpl>(
time_system_);
Envoy::ProtobufMessage::getStrictValidationVisitor(), *api_, creation_status)};
if (!creation_status.ok()) {
ENVOY_LOG(error, "create runtime loader failed. Received bad status: {}",
creation_status.message());
return false;
}

server_ = std::make_unique<NighthawkServerInstance>(
admin_, *api_, *dispatcher_, access_log_manager_, envoy_options_, *runtime_loader_.get(),
*singleton_manager_, tls_, *local_info_, validation_context_, grpc_context_,
router_context_);
server_factory_context_ =
std::make_unique<NighthawkServerFactoryContext>(*server_, scope_root_);
ssl_context_manager_ =
std::make_unique<Envoy::Extensions::TransportSockets::Tls::ContextManagerImpl>(
*server_factory_context_);
cluster_manager_factory_ = std::make_unique<ClusterManagerFactory>(
*server_factory_context_, store_root_, tls_, http_context_,
[dns_resolver]() -> Envoy::Network::DnsResolverSharedPtr { return dns_resolver; },
Expand Down
12 changes: 10 additions & 2 deletions test/client_worker_test.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <functional>
#include <thread>

#include "envoy/common/exception.h"
#include "envoy/upstream/cluster_manager.h"

#include "nighthawk/user_defined_output/user_defined_output_plugin.h"
Expand Down Expand Up @@ -33,12 +34,19 @@ using namespace std::chrono_literals;
namespace Nighthawk {
namespace Client {

namespace {
using EnvoyException = Envoy::EnvoyException;
} // namespace

class ClientWorkerTest : public Test {
public:
ClientWorkerTest()
: api_(Envoy::Api::createApiForTest()), thread_id_(std::this_thread::get_id()) {
loader_ = Envoy::Runtime::LoaderPtr{new Envoy::Runtime::LoaderImpl(
dispatcher_, tls_, {}, local_info_, store_, rand_, validation_visitor_, *api_)};
absl::Status creation_status;
loader_ = Envoy::Runtime::LoaderPtr{
new Envoy::Runtime::LoaderImpl(dispatcher_, tls_, {}, local_info_, store_, rand_,
validation_visitor_, *api_, creation_status)};
THROW_IF_NOT_OK(creation_status);
benchmark_client_ = new MockBenchmarkClient();
sequencer_ = new MockSequencer();
request_generator_ = new MockRequestSource();
Expand Down
10 changes: 8 additions & 2 deletions test/flush_worker_test.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <functional>
#include <thread>

#include "envoy/common/exception.h"

#include "external/envoy/source/common/common/random_generator.h"
#include "external/envoy/source/common/event/dispatcher_impl.h"
#include "external/envoy/source/common/runtime/runtime_impl.h"
Expand All @@ -25,6 +27,7 @@ using ::testing::NiceMock;
using ::testing::ReturnRef;
using ::testing::StrictMock;
using ::testing::Test;
using EnvoyException = Envoy::EnvoyException;

// Number of times the simulated timer loops run in simulateTimerLoop().
const int kNumTimerLoops = 100;
Expand All @@ -37,8 +40,11 @@ class FlushWorkerTest : public Test {
Envoy::Random::RandomGeneratorImpl rand;
NiceMock<Envoy::LocalInfo::MockLocalInfo> local_info;
NiceMock<Envoy::ProtobufMessage::MockValidationVisitor> validation_visitor;
loader_ = Envoy::Runtime::LoaderPtr{new Envoy::Runtime::LoaderImpl(
*dispatcher_, tls_, {}, local_info, store_, rand, validation_visitor, api_)};
absl::Status creation_status;
loader_ = Envoy::Runtime::LoaderPtr{
new Envoy::Runtime::LoaderImpl(*dispatcher_, tls_, {}, local_info, store_, rand,
validation_visitor, api_, creation_status)};
THROW_IF_NOT_OK(creation_status);
sink_ = new StrictMock<Envoy::Stats::MockSink>();
stats_sinks_.emplace_back(sink_);

Expand Down
7 changes: 5 additions & 2 deletions test/worker_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ TEST_F(WorkerTest, WorkerExecutesOnThread) {

TestWorker worker(*api_, tls_);
NiceMock<Envoy::Event::MockDispatcher> dispatcher;
Envoy::Runtime::LoaderPtr loader = Envoy::Runtime::LoaderPtr{new Envoy::Runtime::LoaderImpl(
dispatcher, tls_, {}, local_info_, test_store_, rand_, validation_visitor_, *api_)};
absl::Status creation_status;
Envoy::Runtime::LoaderPtr loader = Envoy::Runtime::LoaderPtr{
new Envoy::Runtime::LoaderImpl(dispatcher, tls_, {}, local_info_, test_store_, rand_,
validation_visitor_, *api_, creation_status)};
ASSERT_TRUE(creation_status.ok());
worker.start();
worker.waitForCompletion();

Expand Down

0 comments on commit c50bfa1

Please sign in to comment.