From 5bd89b157c70a3531ecb4387e4fa8b07c05a241a Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Jan 2020 01:16:33 +0100 Subject: [PATCH 1/6] Update Envoy Update Envoy to 29b30911dbfb3f9760efeb28238ceac36e1a1a23 Brings in the structured versioning API Signed-off-by: Otto van der Schaaf --- .bazelrc | 5 ++- .circleci/config.yml | 5 ++- bazel/repositories.bzl | 4 +- source/client/process_impl.cc | 44 +++++++++++-------- source/client/process_impl.h | 9 ++-- .../server/http_test_server_filter_config.cc | 2 +- 6 files changed, 40 insertions(+), 29 deletions(-) diff --git a/.bazelrc b/.bazelrc index 15173a48b..3f0c52e31 100644 --- a/.bazelrc +++ b/.bazelrc @@ -30,9 +30,10 @@ build:linux --copt=-fPIC # We already have absl in the build, define absl=1 to tell googletest to use absl for backtrace. build --define absl=1 -# Pass PATH, CC and CXX variables from the environment. +# Pass PATH, CC, CXX and LLVM_CONFIG variables from the environment. build --action_env=CC build --action_env=CXX +build --action_env=LLVM_CONFIG build --action_env=PATH # Common flags for sanitizers @@ -162,7 +163,7 @@ build:remote-msan --config=rbe-toolchain-msan # Docker sandbox # NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master/toolchains/rbe_toolchains_config.bzl#L7 -build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:f0b2453c3587e3297f5caf5e97fbf57c97592c96136209ec13fe2795aae2c896 +build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f build:docker-sandbox --spawn_strategy=docker build:docker-sandbox --strategy=Javac=docker build:docker-sandbox --strategy=Closure=docker diff --git a/.circleci/config.yml b/.circleci/config.yml index 8376cfe91..609459b10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,7 @@ -references: +references: envoy-build-image: &envoy-build-image - envoyproxy/envoy-build-ubuntu@sha256:3ca8acc35fdb57ab26e1bb5f9488f37095f45acd77a12602510410dbefa00b58 # October 31th, 2019 + # Jan 9th, 2020 + envoyproxy/envoy-build-ubuntu@sha256:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f version: 2 jobs: build: diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 722b43c7a..8acf449e9 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -1,7 +1,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -ENVOY_COMMIT = "a78311faf214bb9216f92407102b547b6fcd14a3" # December 13th, 2019 -ENVOY_SHA = "2e65ed67b3413e5c177321360ae6e15bf78dac24f65336a252bd59c1f6bb5a08" +ENVOY_COMMIT = "29b30911dbfb3f9760efeb28238ceac36e1a1a23" # Jan 9th, 2019 +ENVOY_SHA = "b52455552e922be27a51c2b0bb6e1c2b73c42207ddee46fd36b22401115e43fa" RULES_PYTHON_COMMIT = "fdbb17a4118a1728d19e638a5291b4c4266ea5b8" RULES_PYTHON_SHA = "9a3d71e348da504a9c4c5e8abd4cb822f7afb32c613dc6ee8b8535333a81a938" diff --git a/source/client/process_impl.cc b/source/client/process_impl.cc index abc42e7ce..6af535dbf 100644 --- a/source/client/process_impl.cc +++ b/source/client/process_impl.cc @@ -237,25 +237,30 @@ ProcessImpl::mergeWorkerStatistics(const StatisticFactory& statistic_factory, return merged_statistics; } -void ProcessImpl::createBootstrapConfiguration(envoy::config::bootstrap::v2::Bootstrap& bootstrap, - const Uri& uri, int number_of_clusters) const { +void ProcessImpl::createBootstrapConfiguration( + envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap, const Uri& uri, + int number_of_clusters) const { for (int i = 0; i < number_of_clusters; i++) { auto* cluster = bootstrap.mutable_static_resources()->add_clusters(); if (uri.scheme() == "https") { - auto* tls_context = cluster->mutable_tls_context(); - *tls_context = options_.tlsContext(); - auto* common_tls_context = tls_context->mutable_common_tls_context(); + auto* transport_socket = cluster->mutable_transport_socket(); + transport_socket->set_name("envoy.transport_sockets.tls"); + envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext context; + // auto* validation_context = + // context.mutable_common_tls_context()->mutable_validation_context(); + // auto* tls_context = &context; + //*tls_context = options_.tlsContext(); + auto* common_tls_context = context.mutable_common_tls_context(); if (options_.h2()) { common_tls_context->add_alpn_protocols("h2"); } else { common_tls_context->add_alpn_protocols("http/1.1"); } + transport_socket->mutable_typed_config()->PackFrom(context); } - if (options_.transportSocket().has_value()) { - *cluster->mutable_transport_socket() = options_.transportSocket().value(); + //*cluster->mutable_transport_socket() = options_.transportSocket().value(); } - cluster->set_name(fmt::format("{}", i)); cluster->mutable_connect_timeout()->set_seconds(options_.timeout().count()); cluster->mutable_max_requests_per_connection()->set_value(options_.maxRequestsPerConnection()); @@ -270,7 +275,8 @@ void ProcessImpl::createBootstrapConfiguration(envoy::config::bootstrap::v2::Boo options_.maxPendingRequests() == 0 ? 1 : options_.maxPendingRequests()); thresholds->mutable_max_requests()->set_value(options_.maxActiveRequests()); - cluster->set_type(envoy::api::v2::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC); + cluster->set_type( + envoy::config::cluster::v3alpha::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC); auto* host = cluster->add_hosts(); auto* socket_address = host->mutable_socket_address(); socket_address->set_address(uri.address()->ip()->addressAsString()); @@ -278,27 +284,28 @@ void ProcessImpl::createBootstrapConfiguration(envoy::config::bootstrap::v2::Boo } } -void ProcessImpl::addTracingCluster(envoy::config::bootstrap::v2::Bootstrap& bootstrap, +void ProcessImpl::addTracingCluster(envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap, const Uri& uri) const { auto* cluster = bootstrap.mutable_static_resources()->add_clusters(); cluster->set_name("tracing"); cluster->mutable_connect_timeout()->set_seconds(options_.timeout().count()); - cluster->set_type(envoy::api::v2::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC); + cluster->set_type( + envoy::config::cluster::v3alpha::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC); auto* host = cluster->add_hosts(); auto* socket_address = host->mutable_socket_address(); socket_address->set_address(uri.address()->ip()->addressAsString()); socket_address->set_port_value(uri.port()); } -void ProcessImpl::setupTracingImplementation(envoy::config::bootstrap::v2::Bootstrap& bootstrap, - const Uri& uri) const { +void ProcessImpl::setupTracingImplementation( + envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap, const Uri& uri) const { #ifdef ZIPKIN_ENABLED auto* http = bootstrap.mutable_tracing()->mutable_http(); auto scheme = uri.scheme(); const std::string kTracingClusterName = "tracing"; http->set_name(fmt::format("envoy.{}", scheme)); RELEASE_ASSERT(scheme == "zipkin", "Only zipkin is supported"); - envoy::config::trace::v2::ZipkinConfig config; + envoy::config::trace::v3alpha::ZipkinConfig config; config.mutable_collector_cluster()->assign(kTracingClusterName); config.mutable_collector_endpoint()->assign(std::string(uri.path())); config.mutable_shared_span_context()->set_value(true); @@ -310,7 +317,8 @@ void ProcessImpl::setupTracingImplementation(envoy::config::bootstrap::v2::Boots #endif } -void ProcessImpl::maybeCreateTracingDriver(const envoy::config::trace::v2::Tracing& configuration) { +void ProcessImpl::maybeCreateTracingDriver( + const envoy::config::trace::v3alpha::Tracing& configuration) { if (configuration.has_http()) { #ifdef ZIPKIN_ENABLED std::string type = configuration.http().name(); @@ -321,10 +329,10 @@ void ProcessImpl::maybeCreateTracingDriver(const envoy::config::trace::v2::Traci // upstream code changes. auto& factory = Config::Utility::getAndCheckFactory( - configuration.http().name()); + configuration.http()); ProtobufTypes::MessagePtr message = Envoy::Config::Utility::translateToFactoryConfig( configuration.http(), Envoy::ProtobufMessage::getStrictValidationVisitor(), factory); - auto zipkin_config = dynamic_cast(*message); + auto zipkin_config = dynamic_cast(*message); Envoy::Tracing::DriverPtr zipkin_driver = std::make_unique( zipkin_config, *cluster_manager_, store_root_, tls_, @@ -375,7 +383,7 @@ bool ProcessImpl::run(OutputCollector& collector) { ? Http1PoolImpl::ConnectionReuseStrategy::LRU : Http1PoolImpl::ConnectionReuseStrategy::MRU); cluster_manager_factory_->setPrefetchConnections(options_.prefetchConnections()); - envoy::config::bootstrap::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v3alpha::Bootstrap bootstrap; createBootstrapConfiguration(bootstrap, uri, number_of_workers); if (tracing_uri != nullptr) { setupTracingImplementation(bootstrap, *tracing_uri); diff --git a/source/client/process_impl.h b/source/client/process_impl.h index c3b4fb23b..5c058ceec 100644 --- a/source/client/process_impl.h +++ b/source/client/process_impl.h @@ -50,12 +50,13 @@ class ProcessImpl : public Process, public Envoy::Logger::Loggable Date: Thu, 9 Jan 2020 01:18:26 +0100 Subject: [PATCH 2/6] Regenerate README.md Signed-off-by: Otto van der Schaaf --- source/server/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/server/README.md b/source/server/README.md index c427c5780..780dd139f 100644 --- a/source/server/README.md +++ b/source/server/README.md @@ -84,7 +84,8 @@ admin: ``` USAGE: -bazel-bin/nighthawk_test_server [--use-fake-symbol-table ] +bazel-bin/nighthawk_test_server [--disable-extensions ] +[--use-fake-symbol-table ] [--cpuset-threads] [--enable-mutex-tracing] [--disable-hot-restart] @@ -114,6 +115,9 @@ bazel-bin/nighthawk_test_server [--use-fake-symbol-table ] Where: +--disable-extensions +Comma-separated list of extensions to disable + --use-fake-symbol-table Use fake symbol table implementation From ccfe6829e73aa16403de451c9b1a338520a3ed38 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Jan 2020 08:50:04 +0100 Subject: [PATCH 3/6] Upgrade and fix transport socket config Signed-off-by: Otto van der Schaaf --- api/client/BUILD | 1 + api/client/options.proto | 3 ++- include/nighthawk/client/options.h | 4 +++- source/client/options_impl.cc | 4 ++-- source/client/options_impl.h | 5 +++-- source/client/process_impl.cc | 2 +- test/mocks.h | 3 ++- test/options_test.cc | 2 +- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/api/client/BUILD b/api/client/BUILD index f0b719779..058dd713b 100644 --- a/api/client/BUILD +++ b/api/client/BUILD @@ -15,6 +15,7 @@ api_cc_py_proto_library( "@envoy_api//envoy/api/v2/auth:pkg", "@envoy_api//envoy/api/v2/cluster:pkg", "@envoy_api//envoy/api/v2/core:pkg", + "@envoy_api//envoy/config/core/v3alpha:pkg", ], ) diff --git a/api/client/options.proto b/api/client/options.proto index 522e92393..c18afd7db 100644 --- a/api/client/options.proto +++ b/api/client/options.proto @@ -6,6 +6,7 @@ import "google/protobuf/duration.proto"; import "google/protobuf/wrappers.proto"; import "envoy/api/v2/auth/cert.proto"; import "envoy/api/v2/core/base.proto"; +import "envoy/config/core/v3alpha/base.proto"; import "validate/validate.proto"; // Allows for static configuration of requests that should be send by the load generator. @@ -142,5 +143,5 @@ message CommandLineOptions { // See :option:`--labels` repeated string labels = 28; // See :option:`--transport-socket` for details. - envoy.api.v2.core.TransportSocket transport_socket = 27; + envoy.config.core.v3alpha.TransportSocket transport_socket = 27; } diff --git a/include/nighthawk/client/options.h b/include/nighthawk/client/options.h index 52d274955..0a6109598 100644 --- a/include/nighthawk/client/options.h +++ b/include/nighthawk/client/options.h @@ -8,6 +8,7 @@ #include "envoy/api/v2/cds.pb.h" #include "envoy/api/v2/core/base.pb.h" #include "envoy/common/pure.h" +#include "envoy/config/core/v3alpha/base.pb.h" #include "api/client/options.pb.h" @@ -41,7 +42,8 @@ class Options { virtual std::vector requestHeaders() const PURE; virtual uint32_t requestBodySize() const PURE; virtual const envoy::api::v2::auth::UpstreamTlsContext& tlsContext() const PURE; - virtual const absl::optional& transportSocket() const PURE; + virtual const absl::optional& + transportSocket() const PURE; virtual uint32_t maxPendingRequests() const PURE; virtual uint32_t maxActiveRequests() const PURE; virtual uint32_t maxRequestsPerConnection() const PURE; diff --git a/source/client/options_impl.cc b/source/client/options_impl.cc index d3200a811..5ec210564 100644 --- a/source/client/options_impl.cc +++ b/source/client/options_impl.cc @@ -352,7 +352,7 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) { } if (!transport_socket.getValue().empty()) { try { - transport_socket_.emplace(envoy::api::v2::core::TransportSocket()); + transport_socket_.emplace(envoy::config::core::v3alpha::TransportSocket()); Envoy::MessageUtil::loadFromJson(transport_socket.getValue(), transport_socket_.value(), Envoy::ProtobufMessage::getStrictValidationVisitor()); } catch (const Envoy::EnvoyException& e) { @@ -436,7 +436,7 @@ OptionsImpl::OptionsImpl(const nighthawk::client::CommandLineOptions& options) { tls_context_.MergeFrom(options.tls_context()); if (options.has_transport_socket()) { - transport_socket_.emplace(envoy::api::v2::core::TransportSocket()); + transport_socket_.emplace(envoy::config::core::v3alpha::TransportSocket()); transport_socket_.value().MergeFrom(options.transport_socket()); } diff --git a/source/client/options_impl.h b/source/client/options_impl.h index c7464a2cd..b1583c2aa 100644 --- a/source/client/options_impl.h +++ b/source/client/options_impl.h @@ -48,7 +48,8 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable& transportSocket() const override { + const absl::optional& + transportSocket() const override { return transport_socket_; } uint32_t maxPendingRequests() const override { return max_pending_requests_; } @@ -94,7 +95,7 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable request_headers_; uint32_t request_body_size_{0}; envoy::api::v2::auth::UpstreamTlsContext tls_context_; - absl::optional transport_socket_; + absl::optional transport_socket_; uint32_t max_pending_requests_{0}; // This default is based the minimum recommendation for SETTINGS_MAX_CONCURRENT_STREAMS over at // https://tools.ietf.org/html/rfc7540#section-6.5.2 diff --git a/source/client/process_impl.cc b/source/client/process_impl.cc index 6af535dbf..549f44b2a 100644 --- a/source/client/process_impl.cc +++ b/source/client/process_impl.cc @@ -259,7 +259,7 @@ void ProcessImpl::createBootstrapConfiguration( transport_socket->mutable_typed_config()->PackFrom(context); } if (options_.transportSocket().has_value()) { - //*cluster->mutable_transport_socket() = options_.transportSocket().value(); + *cluster->mutable_transport_socket() = options_.transportSocket().value(); } cluster->set_name(fmt::format("{}", i)); cluster->mutable_connect_timeout()->set_seconds(options_.timeout().count()); diff --git a/test/mocks.h b/test/mocks.h index 3ac0ffbc1..a44758167 100644 --- a/test/mocks.h +++ b/test/mocks.h @@ -85,7 +85,8 @@ class MockOptions : public Client::Options { MOCK_CONST_METHOD0(requestHeaders, std::vector()); MOCK_CONST_METHOD0(requestBodySize, uint32_t()); MOCK_CONST_METHOD0(tlsContext, envoy::api::v2::auth::UpstreamTlsContext&()); - MOCK_CONST_METHOD0(transportSocket, absl::optional&()); + MOCK_CONST_METHOD0(transportSocket, + absl::optional&()); MOCK_CONST_METHOD0(maxPendingRequests, uint32_t()); MOCK_CONST_METHOD0(maxActiveRequests, uint32_t()); MOCK_CONST_METHOD0(maxRequestsPerConnection, uint32_t()); diff --git a/test/options_test.cc b/test/options_test.cc index 047ee2ff3..f15049be7 100644 --- a/test/options_test.cc +++ b/test/options_test.cc @@ -443,7 +443,7 @@ TEST_F(OptionsImplTest, BadTransportSocketSpecification) { TestUtility::createOptionsImpl(fmt::format("{} --transport-socket {} http://foo/", client_name_, "{misspelled_transport_socket:{}}")), MalformedArgvException, - "Protobuf message \\(type envoy.api.v2.core.TransportSocket reason " + "Protobuf message \\(type envoy.config.core.v3alpha.TransportSocket reason " "INVALID_ARGUMENT:misspelled_transport_socket: Cannot find field.\\) has unknown fields"); } From 20f07d69ea1954ecbeecbbab539d780aaf4eb502 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Jan 2020 09:44:48 +0100 Subject: [PATCH 4/6] Upgrade and fix UpstreamTlsContext Signed-off-by: Otto van der Schaaf --- api/client/BUILD | 1 + api/client/options.proto | 3 ++- include/nighthawk/client/options.h | 4 +++- source/client/options_impl.h | 5 +++-- source/client/process_impl.cc | 5 +---- test/mocks.h | 3 ++- test/options_test.cc | 3 ++- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/api/client/BUILD b/api/client/BUILD index 058dd713b..fb56696c2 100644 --- a/api/client/BUILD +++ b/api/client/BUILD @@ -16,6 +16,7 @@ api_cc_py_proto_library( "@envoy_api//envoy/api/v2/cluster:pkg", "@envoy_api//envoy/api/v2/core:pkg", "@envoy_api//envoy/config/core/v3alpha:pkg", + "@envoy_api//envoy/extensions/transport_sockets/tls/v3alpha:pkg", ], ) diff --git a/api/client/options.proto b/api/client/options.proto index c18afd7db..a93f38284 100644 --- a/api/client/options.proto +++ b/api/client/options.proto @@ -7,6 +7,7 @@ import "google/protobuf/wrappers.proto"; import "envoy/api/v2/auth/cert.proto"; import "envoy/api/v2/core/base.proto"; import "envoy/config/core/v3alpha/base.proto"; +import "envoy/extensions/transport_sockets/tls/v3alpha/cert.proto"; import "validate/validate.proto"; // Allows for static configuration of requests that should be send by the load generator. @@ -117,7 +118,7 @@ message CommandLineOptions { RequestSource request_source = 26; } // See :option:`--tls_context` for details. - envoy.api.v2.auth.UpstreamTlsContext tls_context = 13; + envoy.extensions.transport_sockets.tls.v3alpha.UpstreamTlsContext tls_context = 13; // See :option:`--max-pending_requests` for details. google.protobuf.UInt32Value max_pending_requests = 14; // See :option:`--max-active_requests` for details. diff --git a/include/nighthawk/client/options.h b/include/nighthawk/client/options.h index 0a6109598..0733f2785 100644 --- a/include/nighthawk/client/options.h +++ b/include/nighthawk/client/options.h @@ -8,6 +8,7 @@ #include "envoy/api/v2/cds.pb.h" #include "envoy/api/v2/core/base.pb.h" #include "envoy/common/pure.h" +#include "envoy/config/cluster/v3alpha/cluster.pb.h" #include "envoy/config/core/v3alpha/base.pb.h" #include "api/client/options.pb.h" @@ -41,7 +42,8 @@ class Options { virtual envoy::api::v2::core::RequestMethod requestMethod() const PURE; virtual std::vector requestHeaders() const PURE; virtual uint32_t requestBodySize() const PURE; - virtual const envoy::api::v2::auth::UpstreamTlsContext& tlsContext() const PURE; + virtual const envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext& + tlsContext() const PURE; virtual const absl::optional& transportSocket() const PURE; virtual uint32_t maxPendingRequests() const PURE; diff --git a/source/client/options_impl.h b/source/client/options_impl.h index b1583c2aa..8ef348a4f 100644 --- a/source/client/options_impl.h +++ b/source/client/options_impl.h @@ -45,7 +45,8 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable requestHeaders() const override { return request_headers_; }; uint32_t requestBodySize() const override { return request_body_size_; }; - const envoy::api::v2::auth::UpstreamTlsContext& tlsContext() const override { + const envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext& + tlsContext() const override { return tls_context_; }; const absl::optional& @@ -94,7 +95,7 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable request_headers_; uint32_t request_body_size_{0}; - envoy::api::v2::auth::UpstreamTlsContext tls_context_; + envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext tls_context_; absl::optional transport_socket_; uint32_t max_pending_requests_{0}; // This default is based the minimum recommendation for SETTINGS_MAX_CONCURRENT_STREAMS over at diff --git a/source/client/process_impl.cc b/source/client/process_impl.cc index 549f44b2a..82e6681d2 100644 --- a/source/client/process_impl.cc +++ b/source/client/process_impl.cc @@ -246,10 +246,7 @@ void ProcessImpl::createBootstrapConfiguration( auto* transport_socket = cluster->mutable_transport_socket(); transport_socket->set_name("envoy.transport_sockets.tls"); envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext context; - // auto* validation_context = - // context.mutable_common_tls_context()->mutable_validation_context(); - // auto* tls_context = &context; - //*tls_context = options_.tlsContext(); + context = options_.tlsContext(); auto* common_tls_context = context.mutable_common_tls_context(); if (options_.h2()) { common_tls_context->add_alpn_protocols("h2"); diff --git a/test/mocks.h b/test/mocks.h index a44758167..00846577d 100644 --- a/test/mocks.h +++ b/test/mocks.h @@ -84,7 +84,8 @@ class MockOptions : public Client::Options { MOCK_CONST_METHOD0(requestMethod, envoy::api::v2::core::RequestMethod()); MOCK_CONST_METHOD0(requestHeaders, std::vector()); MOCK_CONST_METHOD0(requestBodySize, uint32_t()); - MOCK_CONST_METHOD0(tlsContext, envoy::api::v2::auth::UpstreamTlsContext&()); + MOCK_CONST_METHOD0(tlsContext, + envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext&()); MOCK_CONST_METHOD0(transportSocket, absl::optional&()); MOCK_CONST_METHOD0(maxPendingRequests, uint32_t()); diff --git a/test/options_test.cc b/test/options_test.cc index f15049be7..dfc9dd54e 100644 --- a/test/options_test.cc +++ b/test/options_test.cc @@ -429,7 +429,8 @@ TEST_F(OptionsImplTest, BadTlsContextSpecification) { EXPECT_THROW_WITH_REGEX( TestUtility::createOptionsImpl(fmt::format("{} --tls-context {} http://foo/", client_name_, "{misspelled_tls_context:{}}")), - MalformedArgvException, "envoy.api.v2.auth.UpstreamTlsContext reason INVALID_ARGUMENT"); + MalformedArgvException, + "envoy.extensions.transport_sockets.tls.v3alpha.UpstreamTlsContext reason INVALID_ARGUMENT"); } TEST_F(OptionsImplTest, BadTransportSocketSpecification) { From 674842237363d540add1362b445e432aa82956a6 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Jan 2020 09:55:14 +0100 Subject: [PATCH 5/6] Upgrade the remaineder & clean up Signed-off-by: Otto van der Schaaf --- api/client/BUILD | 3 --- api/client/options.proto | 6 ++---- include/nighthawk/client/options.h | 4 +--- source/client/factories_impl.cc | 2 +- source/client/options_impl.cc | 4 ++-- source/client/options_impl.h | 7 +++++-- test/mocks.h | 2 +- test/options_test.cc | 2 +- 8 files changed, 13 insertions(+), 17 deletions(-) diff --git a/api/client/BUILD b/api/client/BUILD index fb56696c2..e2f54f289 100644 --- a/api/client/BUILD +++ b/api/client/BUILD @@ -12,9 +12,6 @@ api_cc_py_proto_library( ], visibility = ["//visibility:public"], deps = [ - "@envoy_api//envoy/api/v2/auth:pkg", - "@envoy_api//envoy/api/v2/cluster:pkg", - "@envoy_api//envoy/api/v2/core:pkg", "@envoy_api//envoy/config/core/v3alpha:pkg", "@envoy_api//envoy/extensions/transport_sockets/tls/v3alpha:pkg", ], diff --git a/api/client/options.proto b/api/client/options.proto index a93f38284..0c87cbd75 100644 --- a/api/client/options.proto +++ b/api/client/options.proto @@ -4,16 +4,14 @@ package nighthawk.client; import "google/protobuf/duration.proto"; import "google/protobuf/wrappers.proto"; -import "envoy/api/v2/auth/cert.proto"; -import "envoy/api/v2/core/base.proto"; import "envoy/config/core/v3alpha/base.proto"; import "envoy/extensions/transport_sockets/tls/v3alpha/cert.proto"; import "validate/validate.proto"; // Allows for static configuration of requests that should be send by the load generator. message RequestOptions { - envoy.api.v2.core.RequestMethod request_method = 1; - repeated envoy.api.v2.core.HeaderValueOption request_headers = 2; + envoy.config.core.v3alpha.RequestMethod request_method = 1; + repeated envoy.config.core.v3alpha.HeaderValueOption request_headers = 2; // Our StreamDecoder depends on bounding the size here, so if this changes, an amendment // to that is needed as well. google.protobuf.UInt32Value request_body_size = 3 [(validate.rules).uint32 = {lte: 4194304}]; diff --git a/include/nighthawk/client/options.h b/include/nighthawk/client/options.h index 0733f2785..2313abb03 100644 --- a/include/nighthawk/client/options.h +++ b/include/nighthawk/client/options.h @@ -5,8 +5,6 @@ #include #include -#include "envoy/api/v2/cds.pb.h" -#include "envoy/api/v2/core/base.pb.h" #include "envoy/common/pure.h" #include "envoy/config/cluster/v3alpha/cluster.pb.h" #include "envoy/config/core/v3alpha/base.pb.h" @@ -39,7 +37,7 @@ class Options { virtual bool prefetchConnections() const PURE; virtual uint32_t burstSize() const PURE; virtual nighthawk::client::AddressFamily::AddressFamilyOptions addressFamily() const PURE; - virtual envoy::api::v2::core::RequestMethod requestMethod() const PURE; + virtual envoy::config::core::v3alpha::RequestMethod requestMethod() const PURE; virtual std::vector requestHeaders() const PURE; virtual uint32_t requestBodySize() const PURE; virtual const envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext& diff --git a/source/client/factories_impl.cc b/source/client/factories_impl.cc index 465d2317a..73420ddcc 100644 --- a/source/client/factories_impl.cc +++ b/source/client/factories_impl.cc @@ -123,7 +123,7 @@ RequestSourcePtr RequestSourceFactoryImpl::create() const { UriImpl uri(options_.uri()); Envoy::Http::HeaderMapPtr header = std::make_unique(); - header->setMethod(envoy::api::v2::core::RequestMethod_Name(options_.requestMethod())); + header->setMethod(envoy::config::core::v3alpha::RequestMethod_Name(options_.requestMethod())); header->setPath(uri.path()); header->setHost(uri.hostAndPort()); header->setScheme(uri.scheme() == "https" ? Envoy::Http::Headers::get().SchemeValues.Https diff --git a/source/client/options_impl.cc b/source/client/options_impl.cc index 5ec210564..91e870479 100644 --- a/source/client/options_impl.cc +++ b/source/client/options_impl.cc @@ -258,7 +258,7 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) { if (request_method.isSet()) { std::string upper_cased = request_method.getValue(); absl::AsciiStrToUpper(&upper_cased); - RELEASE_ASSERT(envoy::api::v2::core::RequestMethod_Parse(upper_cased, &request_method_), + RELEASE_ASSERT(envoy::config::core::v3alpha::RequestMethod_Parse(upper_cased, &request_method_), "Failed to parse request method"); } TCLAP_SET_IF_SPECIFIED(request_headers, request_headers_); @@ -414,7 +414,7 @@ OptionsImpl::OptionsImpl(const nighthawk::client::CommandLineOptions& options) { const auto& request_options = options.request_options(); if (request_options.request_method() != - ::envoy::api::v2::core::RequestMethod::METHOD_UNSPECIFIED) { + ::envoy::config::core::v3alpha::RequestMethod::METHOD_UNSPECIFIED) { request_method_ = request_options.request_method(); } request_body_size_ = diff --git a/source/client/options_impl.h b/source/client/options_impl.h index 8ef348a4f..7c61cc3a6 100644 --- a/source/client/options_impl.h +++ b/source/client/options_impl.h @@ -42,7 +42,9 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable requestHeaders() const override { return request_headers_; }; uint32_t requestBodySize() const override { return request_body_size_; }; const envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext& @@ -92,7 +94,8 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable request_headers_; uint32_t request_body_size_{0}; envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext tls_context_; diff --git a/test/mocks.h b/test/mocks.h index 00846577d..6e498cea8 100644 --- a/test/mocks.h +++ b/test/mocks.h @@ -81,7 +81,7 @@ class MockOptions : public Client::Options { MOCK_CONST_METHOD0(prefetchConnections, bool()); MOCK_CONST_METHOD0(burstSize, uint32_t()); MOCK_CONST_METHOD0(addressFamily, nighthawk::client::AddressFamily::AddressFamilyOptions()); - MOCK_CONST_METHOD0(requestMethod, envoy::api::v2::core::RequestMethod()); + MOCK_CONST_METHOD0(requestMethod, envoy::config::core::v3alpha::RequestMethod()); MOCK_CONST_METHOD0(requestHeaders, std::vector()); MOCK_CONST_METHOD0(requestBodySize, uint32_t()); MOCK_CONST_METHOD0(tlsContext, diff --git a/test/options_test.cc b/test/options_test.cc index dfc9dd54e..d12a244ce 100644 --- a/test/options_test.cc +++ b/test/options_test.cc @@ -69,7 +69,7 @@ TEST_F(OptionsImplTest, AlmostAll) { EXPECT_EQ(13, options->burstSize()); EXPECT_EQ(nighthawk::client::AddressFamily::V6, options->addressFamily()); EXPECT_EQ(good_test_uri_, options->uri()); - EXPECT_EQ(envoy::api::v2::core::RequestMethod::POST, options->requestMethod()); + EXPECT_EQ(envoy::config::core::v3alpha::RequestMethod::POST, options->requestMethod()); const std::vector expected_headers = {"f1:b1", "f2:b2", "f3:b3:b4"}; EXPECT_EQ(expected_headers, options->requestHeaders()); EXPECT_EQ(1234, options->requestBodySize()); From 2346949467ef928e44b736d7542b41429cbdfc26 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Jan 2020 10:13:07 +0100 Subject: [PATCH 6/6] Clean up the diff Signed-off-by: Otto van der Schaaf --- .circleci/config.yml | 2 +- source/client/process_impl.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 609459b10..ff9710745 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,4 @@ -references: +references: envoy-build-image: &envoy-build-image # Jan 9th, 2020 envoyproxy/envoy-build-ubuntu@sha256:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f diff --git a/source/client/process_impl.cc b/source/client/process_impl.cc index 82e6681d2..a859eba8b 100644 --- a/source/client/process_impl.cc +++ b/source/client/process_impl.cc @@ -245,8 +245,8 @@ void ProcessImpl::createBootstrapConfiguration( if (uri.scheme() == "https") { auto* transport_socket = cluster->mutable_transport_socket(); transport_socket->set_name("envoy.transport_sockets.tls"); - envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext context; - context = options_.tlsContext(); + envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext context = + options_.tlsContext(); auto* common_tls_context = context.mutable_common_tls_context(); if (options_.h2()) { common_tls_context->add_alpn_protocols("h2");