From 11026b102ae417dfda8f6077cfcc7db7502280ae Mon Sep 17 00:00:00 2001 From: Jakub Sobon Date: Tue, 8 Mar 2022 11:47:07 -0500 Subject: [PATCH 1/8] Update Envoy to d3bd9bb (Mar 7th 2022). (#816) - no changes in `.bazelrc`, `.bazelversion`, `ci/run_envoy_docker.sh` or `tools/gen_compilation_database.py`. - introducing a workaround for our use of the Envoy's `check_format.py` after https://github.com/envoyproxy/envoy/pull/20108. See https://github.com/envoyproxy/nighthawk/issues/815 for details. Signed-off-by: Jakub Sobon --- bazel/repositories.bzl | 4 ++-- tools/check_format.sh | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 25876c9c1..d25d04975 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 = "4ce48c4a89c3aad09949287679ba06a92ca1c540" # Feb 28, 2022 -ENVOY_SHA = "bcfa1c291749de3d30771a713df73d908ec3bf850fdae31eb1c77ddd36a2dc5c" +ENVOY_COMMIT = "d3bd9bbef64abbf1c02fe91231eac8841901131d" # Mar 7, 2022 +ENVOY_SHA = "258f5ca02b22331f4d39334509f38992537a6214a6e9e20b68e65c6f321dee3c" HDR_HISTOGRAM_C_VERSION = "0.11.2" # October 12th, 2020 HDR_HISTOGRAM_C_SHA = "637f28b5f64de2e268131e4e34e6eef0b91cf5ff99167db447d9b2825eae6bad" diff --git a/tools/check_format.sh b/tools/check_format.sh index 3b4fcc1cb..a7daca6a5 100755 --- a/tools/check_format.sh +++ b/tools/check_format.sh @@ -2,17 +2,24 @@ set -e -TO_CHECK="${2:-$PWD}" +# Using a path like ./../nighthawk is a workaround that allows us to skip Envoy +# specific code checks performed by @envoy//tools/code_format:check_format.py. +# TODO(https://github.com/envoyproxy/nighthawk/issues/815): Replace this +# workaround with a permanent solution. +CURRENT_DIRECTORY=${PWD##*/} +FULL_CHECK="./../$CURRENT_DIRECTORY" + +TO_CHECK="${2:-$FULL_CHECK}" # TODO(https://github.com/envoyproxy/nighthawk/issues/165): fully excluding everything # from the build fixer isn't ideal. bazel run @envoy//tools/code_format:check_format.py -- \ --skip_envoy_build_rule_check --namespace_check Nighthawk \ - --build_fixer_check_excluded_paths=$(realpath ".") \ + --build_fixer_check_excluded_paths=$TO_CHECK \ --include_dir_order envoy,nighthawk,external/source/envoy,external,api,common,source,exe,server,client,distributor,sink,grpcpp,request_source,test_common,test \ $1 $TO_CHECK # The include checker doesn't support per-file checking, so we only # run it when a full check is requested. -if [ $PWD == $TO_CHECK ]; then +if [ $FULL_CHECK == $TO_CHECK ]; then bazel run //tools:check_envoy_includes.py -fi \ No newline at end of file +fi From 517d7ceb4c1b9c50618363ede3c8fb0375e6964b Mon Sep 17 00:00:00 2001 From: qqustc Date: Wed, 16 Mar 2022 23:49:14 -0400 Subject: [PATCH 2/8] Add a CLI flag --stats-flush-interval-duration to allow specifying stats flush interval in Duration (#818) New flag --stats-flush-interval-duration is mutually exclusive with --stats-flush-interval. Signed-off-by: qqustc --- README.md | 8 +- api/client/options.proto | 20 +++-- include/nighthawk/client/BUILD | 1 + include/nighthawk/client/options.h | 3 + source/client/options_impl.cc | 48 ++++++++++-- source/client/options_impl.h | 5 ++ source/client/process_bootstrap.cc | 8 +- test/mocks/client/mock_options.h | 1 + test/options_test.cc | 85 ++++++++++++++++++++- test/process_bootstrap_test.cc | 116 +++++++++++++++++++++++++++++ 10 files changed, 280 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ee597f694..27f71b8d1 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ bazel build -c opt //:nighthawk USAGE: bazel-bin/nighthawk_client [--latency-response-header-name ] +[--stats-flush-interval-duration ] [--stats-flush-interval ] [--stats-sinks ] ... [--no-duration] [--simple-warmup] @@ -99,9 +100,14 @@ tandem with the test server's response option "emit_previous_request_delta_in_response_header" to record elapsed time between request arrivals. Default: "" +--stats-flush-interval-duration +Time interval (in Duration) between flushes to configured stats sinks. +For example '1s' or '1.000000001s'. Mutually exclusive with +--stats-flush-interval. + --stats-flush-interval Time interval (in seconds) between flushes to configured stats sinks. -Default: 5. +Mutually exclusive with --stats-flush-interval-duration. Default: 5. --stats-sinks (accepted multiple times) Stats sinks (in json) where Nighthawk metrics will be flushed. This diff --git a/api/client/options.proto b/api/client/options.proto index a267b45a4..1830862d1 100644 --- a/api/client/options.proto +++ b/api/client/options.proto @@ -127,7 +127,7 @@ message Protocol { // TODO(oschaaf): Ultimately this will be a load test specification. The fact that it // can arrive via CLI is just a concrete detail. Change this to reflect that. -// Highest unused number is 110. +// Highest unused number is 111. message CommandLineOptions { // The target requests-per-second rate. Default: 5. google.protobuf.UInt32Value requests_per_second = 1 @@ -264,10 +264,20 @@ message CommandLineOptions { google.protobuf.BoolValue simple_warmup = 32; // Optional set of stat sinks where Nighthawk metrics will be flushed to. repeated envoy.config.metrics.v3.StatsSink stats_sinks = 34; - // Time interval (number of seconds) between periodical flushes to configured stats sinks. If not - // specified the default is 5 seconds. Time interval must be at least 1s and at most 300s. - google.protobuf.UInt32Value stats_flush_interval = 35 - [(validate.rules).uint32 = {gte: 1, lte: 300}]; + + oneof oneof_stats_flush_interval { + // Time interval (number of seconds) between periodical flushes to + // configured stats sinks. If not specified the default is 5 seconds. + // stats_flush_interval must be at least 1s and at most 300s. + google.protobuf.UInt32Value stats_flush_interval = 35 + [(validate.rules).uint32 = {gte: 1, lte: 300}]; + + // Time interval in Duration between periodical flushes to configured stats + // sinks. + google.protobuf.Duration stats_flush_interval_duration = 110 + [(validate.rules).duration = {gte {seconds: 0 nanos: 0}}]; + } + // Set an optional header name that will be returned in responses, whose values will be tracked in // a latency histogram if set. Can be used in tandem with the test server's response option // "emit_previous_request_delta_in_response_header" to record elapsed time between request diff --git a/include/nighthawk/client/BUILD b/include/nighthawk/client/BUILD index 49dd108be..ed62b2c81 100644 --- a/include/nighthawk/client/BUILD +++ b/include/nighthawk/client/BUILD @@ -20,6 +20,7 @@ envoy_basic_cc_library( "@envoy//envoy/common:time_interface", "@envoy//envoy/http:protocol_interface_with_external_headers", "@envoy//source/common/common:minimal_logger_lib_with_external_headers", + "@envoy//source/common/protobuf:utility_lib_with_external_headers", "@envoy_api//envoy/config/cluster/v3:pkg_cc_proto", "@envoy_api//envoy/config/metrics/v3:pkg_cc_proto", ], diff --git a/include/nighthawk/client/options.h b/include/nighthawk/client/options.h index 68a1e3baa..c5fbe44a7 100644 --- a/include/nighthawk/client/options.h +++ b/include/nighthawk/client/options.h @@ -15,6 +15,8 @@ #include "nighthawk/common/termination_predicate.h" +#include "external/envoy/source/common/protobuf/protobuf.h" + #include "api/client/options.pb.h" #include "absl/types/optional.h" @@ -86,6 +88,7 @@ class Options { virtual bool noDuration() const PURE; virtual std::vector statsSinks() const PURE; virtual uint32_t statsFlushInterval() const PURE; + virtual Envoy::ProtobufWkt::Duration statsFlushIntervalDuration() const PURE; virtual std::string responseHeaderWithLatencyInput() const PURE; virtual absl::optional scheduled_start() const PURE; diff --git a/source/client/options_impl.cc b/source/client/options_impl.cc index ee70e7f18..3e40b6b38 100644 --- a/source/client/options_impl.cc +++ b/source/client/options_impl.cc @@ -1,6 +1,7 @@ #include "source/client/options_impl.h" #include "external/envoy/source/common/protobuf/message_validator_impl.h" +#include "external/envoy/source/common/protobuf/protobuf.h" #include "external/envoy/source/common/protobuf/utility.h" #include "api/client/options.pb.validate.h" @@ -331,10 +332,16 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) { TCLAP::ValueArg stats_flush_interval( "", "stats-flush-interval", - fmt::format("Time interval (in seconds) between flushes to configured " - "stats sinks. Default: {}.", - stats_flush_interval_), + fmt::format( + "Time interval (in seconds) between flushes to configured " + "stats sinks. Mutually exclusive with --stats-flush-interval-duration. Default: {}.", + stats_flush_interval_), false, 5, "uint32_t", cmd); + TCLAP::ValueArg stats_flush_interval_duration( + "", "stats-flush-interval-duration", + "Time interval (in Duration) between flushes to configured stats sinks. For example '1s' or " + "'1.000000001s'. Mutually exclusive with --stats-flush-interval.", + false, "", "duration", cmd); TCLAP::ValueArg latency_response_header_name( "", "latency-response-header-name", @@ -362,10 +369,19 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) { throw MalformedArgvException("--duration and --no-duration are mutually exclusive"); } - // Verify that if --stats-flush-interval is set, then --stats-sinks must also be set. - if (stats_flush_interval.isSet() && !stats_sinks.isSet()) { + // --stats-flush-interval and --stats-flush-interval-duration are mutually exclusive. + if (stats_flush_interval.isSet() && stats_flush_interval_duration.isSet()) { + throw MalformedArgvException("--stats-flush-interval and --stats-flush-interval-duration are " + "mutually exclusive"); + } + + // Verify that if --stats-flush-interval or --stats-flush-interval-duration is + // set, then --stats-sinks must also be set. + if ((stats_flush_interval.isSet() || stats_flush_interval_duration.isSet()) && + !stats_sinks.isSet()) { throw MalformedArgvException( - "if --stats-flush-interval is set, then --stats-sinks must also be set"); + "if --stats-flush-interval or --stats-flush-interval-duration is set, " + "then --stats-sinks must also be set"); } TCLAP_SET_IF_SPECIFIED(requests_per_second, requests_per_second_); @@ -496,6 +512,17 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) { } } TCLAP_SET_IF_SPECIFIED(stats_flush_interval, stats_flush_interval_); + if (stats_flush_interval_duration.isSet()) { + if (Envoy::Protobuf::util::TimeUtil::FromString(stats_flush_interval_duration.getValue(), + &stats_flush_interval_duration_)) { + if (stats_flush_interval_duration_.nanos() < 0 || + stats_flush_interval_duration_.seconds() < 0) { + throw MalformedArgvException("--stats-flush-interval-duration is out of range"); + } + } else { + throw MalformedArgvException("Invalid value for --stats-flush-interval-duration"); + } + } TCLAP_SET_IF_SPECIFIED(latency_response_header_name, latency_response_header_name_); // CLI-specific tests. @@ -725,6 +752,9 @@ OptionsImpl::OptionsImpl(const nighthawk::client::CommandLineOptions& options) { } stats_flush_interval_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT(options, stats_flush_interval, stats_flush_interval_); + if (options.has_stats_flush_interval_duration()) { + stats_flush_interval_duration_ = options.stats_flush_interval_duration(); + } nighthawk_service_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT(options, nighthawk_service, nighthawk_service_); h2_use_multiple_connections_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT( @@ -933,7 +963,11 @@ CommandLineOptionsPtr OptionsImpl::toCommandLineOptionsInternal() const { for (const envoy::config::metrics::v3::StatsSink& stats_sink : stats_sinks_) { *command_line_options->add_stats_sinks() = stats_sink; } - command_line_options->mutable_stats_flush_interval()->set_value(stats_flush_interval_); + if (stats_flush_interval_duration_.seconds() > 0 || stats_flush_interval_duration_.nanos() > 0) { + *command_line_options->mutable_stats_flush_interval_duration() = stats_flush_interval_duration_; + } else { + command_line_options->mutable_stats_flush_interval()->set_value(stats_flush_interval_); + } command_line_options->mutable_latency_response_header_name()->set_value( latency_response_header_name_); if (scheduled_start_.has_value()) { diff --git a/source/client/options_impl.h b/source/client/options_impl.h index 6f4ad64f8..4f248fdc9 100644 --- a/source/client/options_impl.h +++ b/source/client/options_impl.h @@ -9,6 +9,7 @@ #include "nighthawk/common/exception.h" #include "external/envoy/source/common/common/logger.h" +#include "external/envoy/source/common/protobuf/protobuf.h" #include "absl/types/optional.h" #include "tclap/CmdLine.h" @@ -98,6 +99,9 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable stats_sinks_; uint32_t stats_flush_interval_{5}; + Envoy::ProtobufWkt::Duration stats_flush_interval_duration_; std::string latency_response_header_name_; absl::optional scheduled_start_; absl::optional execution_id_; diff --git a/source/client/process_bootstrap.cc b/source/client/process_bootstrap.cc index 72494c42f..cd1dc40ec 100644 --- a/source/client/process_bootstrap.cc +++ b/source/client/process_bootstrap.cc @@ -254,7 +254,13 @@ absl::StatusOr createBootstrapConfiguration( for (const StatsSink& stats_sink : options.statsSinks()) { *bootstrap.add_stats_sinks() = stats_sink; } - bootstrap.mutable_stats_flush_interval()->set_seconds(options.statsFlushInterval()); + + if (options.statsFlushIntervalDuration().seconds() > 0 || + options.statsFlushIntervalDuration().nanos() > 0) { + *bootstrap.mutable_stats_flush_interval() = options.statsFlushIntervalDuration(); + } else { + bootstrap.mutable_stats_flush_interval()->set_seconds(options.statsFlushInterval()); + } if (options.upstreamBindConfig().has_value()) { *bootstrap.mutable_cluster_manager()->mutable_upstream_bind_config() = diff --git a/test/mocks/client/mock_options.h b/test/mocks/client/mock_options.h index 121bd2690..1d9084b44 100644 --- a/test/mocks/client/mock_options.h +++ b/test/mocks/client/mock_options.h @@ -64,6 +64,7 @@ class MockOptions : public Options { MOCK_METHOD(std::vector, statsSinks, (), (const, override)); MOCK_METHOD(uint32_t, statsFlushInterval, (), (const, override)); + MOCK_METHOD(Envoy::ProtobufWkt::Duration, statsFlushIntervalDuration, (), (const, override)); MOCK_METHOD(std::string, responseHeaderWithLatencyInput, (), (const, override)); MOCK_METHOD(bool, allowEnvoyDeprecatedV2Api, (), (const)); MOCK_METHOD(absl::optional, scheduled_start, (), (const, override)); diff --git a/test/options_test.cc b/test/options_test.cc index 73514a68f..bb68cfcc2 100644 --- a/test/options_test.cc +++ b/test/options_test.cc @@ -84,11 +84,94 @@ TEST_F(OptionsImplTest, DurationAndNoDurationSanity) { EXPECT_TRUE(cmd->no_duration().value()); } +TEST_F(OptionsImplTest, StatsFlushIntervalAndStatsFlushIntervalDurationAreMutuallyExclusive) { + EXPECT_THROW_WITH_REGEX( + TestUtility::createOptionsImpl( + fmt::format("{} --stats-flush-interval 5 --stats-flush-interval-duration 1s http://foo", + client_name_)), + MalformedArgvException, "mutually exclusive"); +} + TEST_F(OptionsImplTest, StatsSinksMustBeSetWhenStatsFlushIntervalSet) { EXPECT_THROW_WITH_REGEX( TestUtility::createOptionsImpl(fmt::format("{} --stats-flush-interval 10", client_name_)), MalformedArgvException, - "if --stats-flush-interval is set, then --stats-sinks must also be set"); + "if --stats-flush-interval or --stats-flush-interval-duration is set, then --stats-sinks " + "must also be set"); +} + +TEST_F(OptionsImplTest, StatsSinksMustBeSetWhenStatsFlushIntervalDurationSet) { + EXPECT_THROW_WITH_REGEX(TestUtility::createOptionsImpl(fmt::format( + "{} --stats-flush-interval-duration 1.000000001s", client_name_)), + MalformedArgvException, + "if --stats-flush-interval or --stats-flush-interval-duration is set, " + "then --stats-sinks must also be set"); +} + +TEST_F(OptionsImplTest, InvalidStatsFlushIntervalDuration) { + const std::string sink_json = + "{name:\"envoy.stat_sinks.statsd\",typed_config:{\"@type\":\"type." + "googleapis.com/" + "envoy.config.metrics.v3.StatsdSink\",tcp_cluster_name:\"statsd\"}}"; + + EXPECT_THROW_WITH_REGEX( + TestUtility::createOptionsImpl(fmt::format( + "{} --stats-flush-interval-duration invalid-duration --stats-sinks {} http://foo", + client_name_, sink_json)), + MalformedArgvException, "Invalid value for --stats-flush-interval-duration"); +} + +TEST_F(OptionsImplTest, SecondsOutOfRangeStatsFlushIntervalDuration) { + const std::string sink_json = + "{name:\"envoy.stat_sinks.statsd\",typed_config:{\"@type\":\"type." + "googleapis.com/" + "envoy.config.metrics.v3.StatsdSink\",tcp_cluster_name:\"statsd\"}}"; + EXPECT_THROW_WITH_REGEX(TestUtility::createOptionsImpl(fmt::format( + "{} --stats-flush-interval-duration -1s --stats-sinks {} http://foo", + client_name_, sink_json)), + MalformedArgvException, + "--stats-flush-interval-duration is out of range"); +} + +TEST_F(OptionsImplTest, NanosOutOfRangeStatsFlushIntervalDuration) { + const std::string sink_json = + "{name:\"envoy.stat_sinks.statsd\",typed_config:{\"@type\":\"type." + "googleapis.com/" + "envoy.config.metrics.v3.StatsdSink\",tcp_cluster_name:\"statsd\"}}"; + EXPECT_THROW_WITH_REGEX( + TestUtility::createOptionsImpl(fmt::format( + "{} --stats-flush-interval-duration -0.000000001s --stats-sinks {} http://foo", + client_name_, sink_json)), + MalformedArgvException, "--stats-flush-interval-duration is out of range"); +} + +TEST_F(OptionsImplTest, + SanityCheckDefaultWhenBothStatsFlushIntervalAndStatsFlushIntervalDurationNotSet) { + std::unique_ptr options = + TestUtility::createOptionsImpl(fmt::format("{} http://foo", client_name_)); + EXPECT_EQ(5, options->statsFlushInterval()); + EXPECT_EQ(0, options->statsFlushIntervalDuration().seconds()); + EXPECT_EQ(0, options->statsFlushIntervalDuration().nanos()); + + CommandLineOptionsPtr cmd = options->toCommandLineOptions(); + EXPECT_FALSE(cmd->has_stats_flush_interval_duration()); + ASSERT_TRUE(cmd->has_stats_flush_interval()); + EXPECT_EQ(5, cmd->stats_flush_interval().value()); +} + +TEST_F(OptionsImplTest, SanityCheckWhenStatsFlushIntervalDurationIsSet) { + const std::string sink_json = + "{name:\"envoy.stat_sinks.statsd\",typed_config:{\"@type\":\"type." + "googleapis.com/" + "envoy.config.metrics.v3.StatsdSink\",tcp_cluster_name:\"statsd\"}}"; + std::unique_ptr options = TestUtility::createOptionsImpl( + fmt::format("{} --stats-flush-interval-duration 1.000000001s --stats-sinks {} http://foo", + client_name_, sink_json)); + CommandLineOptionsPtr cmd = options->toCommandLineOptions(); + EXPECT_FALSE(cmd->has_stats_flush_interval()); + ASSERT_TRUE(cmd->has_stats_flush_interval_duration()); + EXPECT_EQ(1, cmd->stats_flush_interval_duration().seconds()); + EXPECT_EQ(1, cmd->stats_flush_interval_duration().nanos()); } // This test should cover every option we offer, except some mutually exclusive ones that diff --git a/test/process_bootstrap_test.cc b/test/process_bootstrap_test.cc index 936301cbb..97e697c5d 100644 --- a/test/process_bootstrap_test.cc +++ b/test/process_bootstrap_test.cc @@ -1241,6 +1241,122 @@ TEST_F(CreateBootstrapConfigurationTest, CreatesBootstrapWithCustomOptions) { Envoy::MessageUtil::validate(*bootstrap, Envoy::ProtobufMessage::getStrictValidationVisitor()); } +TEST_F(CreateBootstrapConfigurationTest, CreatesBootstrapWithStatsFlushIntervalDuration) { + setupUriResolutionExpectations(); + + const std::string stats_sink_json = + "{name:\"envoy.stat_sinks.statsd\",typed_config:{\"@type\":\"type." + "googleapis.com/" + "envoy.config.metrics.v3.StatsdSink\",tcp_cluster_name:\"statsd\"}}"; + + const std::string tls_context_json = "{common_tls_context:{tls_params:{" + "cipher_suites:[\"-ALL:ECDHE-RSA-AES256-GCM-SHA384\"]}}}"; + + std::unique_ptr options = Client::TestUtility::createOptionsImpl( + fmt::format("nighthawk_client " + "--max-pending-requests 10 " + "--stats-sinks {} " + "--stats-flush-interval-duration 1.000000001s " + "--tls-context {} " + "https://www.example.org", + stats_sink_json, tls_context_json)); + + absl::StatusOr expected_bootstrap = parseBootstrapFromText(R"pb( + static_resources { + clusters { + name: "0" + type: STATIC + connect_timeout { + seconds: 30 + } + circuit_breakers { + thresholds { + max_connections { + value: 100 + } + max_pending_requests { + value: 10 + } + max_requests { + value: 100 + } + max_retries { + } + } + } + transport_socket { + name: "envoy.transport_sockets.tls" + typed_config { + [type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext] { + common_tls_context { + tls_params { + cipher_suites: "-ALL:ECDHE-RSA-AES256-GCM-SHA384" + } + alpn_protocols: "http/1.1" + } + sni: "www.example.org" + } + } + } + load_assignment { + cluster_name: "0" + endpoints { + lb_endpoints { + endpoint { + address { + socket_address { + address: "127.0.0.1" + port_value: 443 + } + } + } + } + } + } + typed_extension_protocol_options { + key: "envoy.extensions.upstreams.http.v3.HttpProtocolOptions" + value { + [type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions] { + common_http_protocol_options { + max_requests_per_connection { + value: 4294937295 + } + } + explicit_http_config { + http_protocol_options { + } + } + } + } + } + } + } + stats_sinks { + name: "envoy.stat_sinks.statsd" + typed_config { + [type.googleapis.com/envoy.config.metrics.v3.StatsdSink] { + tcp_cluster_name: "statsd" + } + } + } + stats_flush_interval { + seconds: 1 + nanos: 1 + } + )pb"); + ASSERT_THAT(expected_bootstrap, StatusIs(absl::StatusCode::kOk)); + + NiceMock api; + absl::StatusOr bootstrap = + createBootstrapConfiguration(mock_dispatcher_, api, *options, mock_dns_resolver_factory_, + typed_dns_resolver_config_, number_of_workers_); + ASSERT_THAT(bootstrap, StatusIs(absl::StatusCode::kOk)); + EXPECT_THAT(*bootstrap, EqualsProto(*expected_bootstrap)); + + // Ensure the generated bootstrap is valid. + Envoy::MessageUtil::validate(*bootstrap, Envoy::ProtobufMessage::getStrictValidationVisitor()); +} + TEST_F(CreateBootstrapConfigurationTest, CreatesBootstrapSetsMaxRequestToAtLeastOne) { setupUriResolutionExpectations(); From c2321153b0a5f7070501249c7b9dde4a8f431fc2 Mon Sep 17 00:00:00 2001 From: eric846 <56563761+eric846@users.noreply.github.com> Date: Thu, 17 Mar 2022 00:08:44 -0400 Subject: [PATCH 3/8] Update Envoy to c55b207 (Mar 14, 2022) (#817) - New `.bazelrc` from Envoy - Add placeholder `Envoy::Server::Instance` where the `ClusterManagerFactory` constructor (inherited from Envoy's `Envoy::Upstream::ProdClusterManagerFactory`) now requires one. - Run `pytest` with `--assert=plain` to work around `TypeError: required field "lineno" missing from alias` which started happening for unknown reasons in this PR in local `ci/do_ci.sh test` RBE runs, including on a clean machine. Opened #819. Signed-off-by: eric846 <56563761+eric846@users.noreply.github.com> --- .bazelrc | 2 +- bazel/repositories.bzl | 4 +- source/client/BUILD | 1 + source/client/process_impl.cc | 67 ++++++++++++++++++- source/client/process_impl.h | 4 ++ test/integration/integration_test.py | 1 + .../unit_tests/test_nighthawk_test_server.py | 2 +- test/integration/unit_tests/test_utility.py | 2 +- 8 files changed, 76 insertions(+), 7 deletions(-) diff --git a/.bazelrc b/.bazelrc index e62a3bffb..aefcf21e5 100644 --- a/.bazelrc +++ b/.bazelrc @@ -288,7 +288,7 @@ build:remote-clang-cl --config=rbe-toolchain-clang-cl # Docker sandbox # NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/main/toolchains/rbe_toolchains_config.bzl#L8 -build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:514e2f7bc36c1f0495a523b16aab9168a4aa13b6 +build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:d859a503314ae611bb7ca4a7b4b4a19194e199f0 build:docker-sandbox --spawn_strategy=docker build:docker-sandbox --strategy=Javac=docker build:docker-sandbox --strategy=Closure=docker diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index d25d04975..d638d5265 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 = "d3bd9bbef64abbf1c02fe91231eac8841901131d" # Mar 7, 2022 -ENVOY_SHA = "258f5ca02b22331f4d39334509f38992537a6214a6e9e20b68e65c6f321dee3c" +ENVOY_COMMIT = "c55b207b97e0d08358f7603e54cceaa9c5f158b3" # Mar 14, 2022 +ENVOY_SHA = "208218cabc234312f53fe40f9892b85d28cab92996b345e2682362b5edf0fa90" HDR_HISTOGRAM_C_VERSION = "0.11.2" # October 12th, 2020 HDR_HISTOGRAM_C_SHA = "637f28b5f64de2e268131e4e34e6eef0b91cf5ff99167db447d9b2825eae6bad" diff --git a/source/client/BUILD b/source/client/BUILD index bee064852..771f7e466 100644 --- a/source/client/BUILD +++ b/source/client/BUILD @@ -133,6 +133,7 @@ envoy_cc_library( "@envoy//source/server/config_validation:admin_lib_with_external_headers", "@envoy//envoy/http:protocol_interface_with_external_headers", "@envoy//envoy/network:address_interface", + "@envoy//envoy/server:instance_interface", "@envoy//source/common/common:statusor_lib_with_external_headers", "@envoy//source/common/router:context_lib_with_external_headers", "@envoy_api//envoy/config/core/v3:pkg_cc_proto", diff --git a/source/client/process_impl.cc b/source/client/process_impl.cc index f07e7f235..577257bd9 100644 --- a/source/client/process_impl.cc +++ b/source/client/process_impl.cc @@ -100,6 +100,68 @@ class BootstrapFactory : public Envoy::Logger::Loggable } }; +// Implementation of Envoy::Server::Instance used as a placeholder. None of its methods +// should be called because Nighthawk is not a real Envoy that performs xDS config validation. +class NullServerInstance : public Envoy::Server::Instance { + Envoy::Server::Admin& admin() override { PANIC("not implemented"); } + Envoy::Api::Api& api() override { PANIC("not implemented"); } + Envoy::Upstream::ClusterManager& clusterManager() override { PANIC("not implemented"); } + const Envoy::Upstream::ClusterManager& clusterManager() const override { + PANIC("not implemented"); + } + Envoy::Ssl::ContextManager& sslContextManager() override { PANIC("not implemented"); } + Envoy::Event::Dispatcher& dispatcher() override { PANIC("not implemented"); } + Envoy::Network::DnsResolverSharedPtr dnsResolver() override { PANIC("not implemented"); } + void drainListeners() override { PANIC("not implemented"); } + Envoy::Server::DrainManager& drainManager() override { PANIC("not implemented"); } + Envoy::AccessLog::AccessLogManager& accessLogManager() override { PANIC("not implemented"); } + void failHealthcheck(bool) override { PANIC("not implemented"); } + bool healthCheckFailed() override { PANIC("not implemented"); } + Envoy::Server::HotRestart& hotRestart() override { PANIC("not implemented"); } + Envoy::Init::Manager& initManager() override { PANIC("not implemented"); } + Envoy::Server::ListenerManager& listenerManager() override { PANIC("not implemented"); } + Envoy::MutexTracer* mutexTracer() override { PANIC("not implemented"); } + Envoy::Server::OverloadManager& overloadManager() override { PANIC("not implemented"); } + Envoy::Secret::SecretManager& secretManager() override { PANIC("not implemented"); } + const Envoy::Server::Options& options() override { PANIC("not implemented"); } + Envoy::Runtime::Loader& runtime() override { PANIC("not implemented"); } + Envoy::Server::ServerLifecycleNotifier& lifecycleNotifier() override { PANIC("not implemented"); } + void shutdown() override { PANIC("not implemented"); } + bool isShutdown() override { PANIC("not implemented"); } + void shutdownAdmin() override { PANIC("not implemented"); } + Envoy::Singleton::Manager& singletonManager() override { PANIC("not implemented"); } + time_t startTimeCurrentEpoch() override { PANIC("not implemented"); } + time_t startTimeFirstEpoch() override { PANIC("not implemented"); } + Envoy::Stats::Store& stats() override { PANIC("not implemented"); } + Envoy::Grpc::Context& grpcContext() override { PANIC("not implemented"); } + Envoy::Http::Context& httpContext() override { PANIC("not implemented"); } + Envoy::Router::Context& routerContext() override { PANIC("not implemented"); } + Envoy::ProcessContextOptRef processContext() override { PANIC("not implemented"); } + Envoy::ThreadLocal::Instance& threadLocal() override { PANIC("not implemented"); } + Envoy::LocalInfo::LocalInfo& localInfo() const override { PANIC("not implemented"); } + Envoy::TimeSource& timeSource() override { PANIC("not implemented"); } + void flushStats() override { PANIC("not implemented"); } + Envoy::ProtobufMessage::ValidationContext& messageValidationContext() override { + PANIC("not implemented"); + } + Envoy::Server::Configuration::StatsConfig& statsConfig() override { PANIC("not implemented"); } + envoy::config::bootstrap::v3::Bootstrap& bootstrap() override { PANIC("not implemented"); } + Envoy::Server::Configuration::ServerFactoryContext& serverFactoryContext() override { + PANIC("not implemented"); + } + Envoy::Server::Configuration::TransportSocketFactoryContext& + transportSocketFactoryContext() override { + PANIC("not implemented"); + } + void setDefaultTracingConfig(const envoy::config::trace::v3::Tracing&) override { + PANIC("not implemented"); + } + bool enableReusePortDefault() override { PANIC("not implemented"); } + void setSinkPredicates(std::unique_ptr&&) override { + PANIC("not implemented"); + } +}; + } // namespace // We customize ProdClusterManagerFactory for the sole purpose of returning our specialized @@ -188,7 +250,8 @@ ProcessImpl::ProcessImpl(const Options& options, Envoy::Event::TimeSystem& time_ typed_dns_resolver_config_(std::move(typed_dns_resolver_config)), init_watcher_("Nighthawk", []() {}), admin_(Envoy::Network::Address::InstanceConstSharedPtr()), - validation_context_(false, false, false), router_context_(store_root_.symbolTable()) { + validation_context_(false, false, false), router_context_(store_root_.symbolTable()), + server_(std::make_unique()) { // Any dispatchers created after the following call will use hr timers. setupForHRTimers(); std::string lower = absl::AsciiStrToLower( @@ -480,7 +543,7 @@ bool ProcessImpl::runInternal(OutputCollector& collector, const UriPtr& tracing_ admin_, Envoy::Runtime::LoaderSingleton::get(), store_root_, tls_, dns_resolver, *ssl_context_manager_, *dispatcher_, *local_info_, secret_manager_, validation_context_, *api_, http_context_, grpc_context_, router_context_, access_log_manager_, - *singleton_manager_, envoy_options, quic_stat_names_); + *singleton_manager_, envoy_options, quic_stat_names_, *server_); cluster_manager_factory_->setConnectionReuseStrategy( options_.h1ConnectionReuseStrategy() == nighthawk::client::H1ConnectionReuseStrategy::LRU ? Http1PoolImpl::ConnectionReuseStrategy::LRU diff --git a/source/client/process_impl.h b/source/client/process_impl.h index 37f1d8f70..d4dcd7d1a 100644 --- a/source/client/process_impl.h +++ b/source/client/process_impl.h @@ -4,6 +4,7 @@ #include "envoy/api/api.h" #include "envoy/network/address.h" +#include "envoy/server/instance.h" #include "envoy/stats/store.h" #include "envoy/tracing/http_tracer.h" @@ -210,6 +211,9 @@ class ProcessImpl : public Process, public Envoy::Logger::Loggable flush_worker_; Envoy::Router::ContextImpl router_context_; + // Null server implementation used as a placeholder. Its methods should never get called + // because Nighthawk is not a full Envoy server that performs xDS config validation. + std::unique_ptr server_; }; } // namespace Client diff --git a/test/integration/integration_test.py b/test/integration/integration_test.py index 6c49d974c..aa023534c 100644 --- a/test/integration/integration_test.py +++ b/test/integration/integration_test.py @@ -12,6 +12,7 @@ test_selection_arg = sys.argv[1] if len(sys.argv) > 1 else "" r = pytest.main( [ + "--assert=plain", "--rootdir=" + path, "-vvvv", "--showlocals", # Don't abbreviate/truncate long values in asserts. diff --git a/test/integration/unit_tests/test_nighthawk_test_server.py b/test/integration/unit_tests/test_nighthawk_test_server.py index cd7a25e83..60d334c27 100644 --- a/test/integration/unit_tests/test_nighthawk_test_server.py +++ b/test/integration/unit_tests/test_nighthawk_test_server.py @@ -136,4 +136,4 @@ def test_extractWarningsAndErrors_applies_all_matching_ignore_lists(): if __name__ == "__main__": - raise SystemExit(pytest.main([__file__])) + raise SystemExit(pytest.main([__file__, "--assert=plain"])) diff --git a/test/integration/unit_tests/test_utility.py b/test/integration/unit_tests/test_utility.py index 9bc25c916..c86ce241a 100644 --- a/test/integration/unit_tests/test_utility.py +++ b/test/integration/unit_tests/test_utility.py @@ -72,4 +72,4 @@ def test_count_log_lines_with_substring_returns_zero_with_empty_logs(): if __name__ == "__main__": - raise SystemExit(pytest.main([__file__])) + raise SystemExit(pytest.main([__file__, "--assert=plain"])) From 1c3056bc483d6aa3928a2f2bcf9f866a0d637c96 Mon Sep 17 00:00:00 2001 From: "Jiajun Ye (Jason)" Date: Tue, 22 Mar 2022 23:37:01 -0400 Subject: [PATCH 4/8] Update Envoy to ad9434b (Mar 21st 2022) (#822) - Update the `ENVOY_COMMIT` and `ENVOY_SHA` in [bazel/repositories.bzl](https://github.com/envoyproxy/nighthawk/blob/main/bazel/repositories.bzl) to the latest Envoy's commit. - Sync [.bazelrc](https://github.com/envoyproxy/nighthawk/blob/main/.bazelrc) from Envoy's version to update our build configurations. - Update `envoyproxy/envoy-build-ubuntu` over at the top of [.circleci/config.yml](https://github.com/envoyproxy/nighthawk/blob/main/.circleci/config.yml) with the new SHA in the `experimental_docker_image` in [.bazelrc](https://github.com/envoyproxy/nighthawk/blob/main/.bazelrc). - Update the `allocateConnPool()` overriding in `process_impl.cc` to accommodate the changes in `cluster_manager_impl` by https://github.com/envoyproxy/envoy/commit/d63c423be9dfbf191955dda51cda8803837c2395 - Update the `percentile-column-overflow.txt.gold` to pass the `output_formatter_test`. It was failed with the error: ``` test/output_formatter_test.cc:84: Failure Expected equality of these values: s Which is: "Nighthawk - A layer 7 protocol benchmarking tool.\n\nfoo (1 samples)\n m output Which is: "Nighthawk - A layer 7 protocol benchmarking tool.\n\nfoo (1 samples)\n m With diff: @@ -2,5 +2,5 @@ foo (1 samples) - min: 0 | mean: 0.0 | max: 0 | pstdev: 0.0 + min: 0 | mean: 0 | max: 0 | pstdev: 0 ``` - Update README.md by executing `tools/update_cli_readme_documentation.sh --mode fix` - Add `--assert=plain pytest` argument to `benchmarks.py` as a workaround to resolve the failure of `benchmark_with_own_binaries` which is related to https://github.com/envoyproxy/nighthawk/issues/819 Signed-off-by: jiajunye [jiajunye@google.com](mailto:jiajunye@google.com) --- .bazelrc | 2 +- .circleci/config.yml | 2 +- README.md | 8 ++++---- bazel/repositories.bzl | 4 ++-- benchmarks/benchmarks.py | 4 ++-- source/client/process_impl.cc | 5 +++-- test/test_data/percentile-column-overflow.txt.gold | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.bazelrc b/.bazelrc index aefcf21e5..153f26cbf 100644 --- a/.bazelrc +++ b/.bazelrc @@ -288,7 +288,7 @@ build:remote-clang-cl --config=rbe-toolchain-clang-cl # Docker sandbox # NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/main/toolchains/rbe_toolchains_config.bzl#L8 -build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:d859a503314ae611bb7ca4a7b4b4a19194e199f0 +build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:142e6d5662b98277a84c327da26ed266ab0e3191 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 578eed4e6..1b028ff45 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ references: envoy-build-image: &envoy-build-image - envoyproxy/envoy-build-ubuntu:514e2f7bc36c1f0495a523b16aab9168a4aa13b6 + envoyproxy/envoy-build-ubuntu:142e6d5662b98277a84c327da26ed266ab0e3191 version: 2 jobs: build: diff --git a/README.md b/README.md index 27f71b8d1..e5386d307 100644 --- a/README.md +++ b/README.md @@ -257,8 +257,8 @@ Use proactive connection prefetching (HTTP/1 only). --output-format -Output format. Possible values: {"json", "human", "yaml", "dotted", -"fortio", "experimental_fortio_pedantic"}. The default output format +Output format. Possible values: ["json", "human", "yaml", "dotted", +"fortio", "experimental_fortio_pedantic"]. The default output format is 'human'. -v , --verbosity -(required) Output format. Possible values: {"json", "human", "yaml", -"dotted", "fortio", "experimental_fortio_pedantic"}. +(required) Output format. Possible values: ["json", "human", "yaml", +"dotted", "fortio", "experimental_fortio_pedantic"]. --, --ignore_rest Ignores the rest of the labeled arguments following this flag. diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index d638d5265..9c1fe696b 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 = "c55b207b97e0d08358f7603e54cceaa9c5f158b3" # Mar 14, 2022 -ENVOY_SHA = "208218cabc234312f53fe40f9892b85d28cab92996b345e2682362b5edf0fa90" +ENVOY_COMMIT = "ad9434b0ca7740deb48f556cfb7097b40b6e625c" # Mar 21, 2022 +ENVOY_SHA = "546f13a22250eabe83ef1b07b6d58e7b20bf71869e9ad10b48990ccd3a6172b7" HDR_HISTOGRAM_C_VERSION = "0.11.2" # October 12th, 2020 HDR_HISTOGRAM_C_SHA = "637f28b5f64de2e268131e4e34e6eef0b91cf5ff99167db447d9b2825eae6bad" diff --git a/benchmarks/benchmarks.py b/benchmarks/benchmarks.py index b4c22b358..fd7f21177 100644 --- a/benchmarks/benchmarks.py +++ b/benchmarks/benchmarks.py @@ -10,7 +10,7 @@ if __name__ == '__main__': path = os.path.dirname(os.path.realpath(__file__)) r = pytest.main([ - "--rootdir=" + path, "-x", path, "-p", "no:cacheprovider", "--log-level", "INFO", - "--log-cli-level", "INFO", *sys.argv + "--assert=plain", "--rootdir=" + path, "-x", path, "-p", "no:cacheprovider", "--log-level", + "INFO", "--log-cli-level", "INFO", *sys.argv ]) exit(r) diff --git a/source/client/process_impl.cc b/source/client/process_impl.cc index 577257bd9..6d3d13cbf 100644 --- a/source/client/process_impl.cc +++ b/source/client/process_impl.cc @@ -177,7 +177,8 @@ class ClusterManagerFactory : public Envoy::Upstream::ProdClusterManagerFactory alternate_protocol_options, const Envoy::Network::ConnectionSocket::OptionsSharedPtr& options, const Envoy::Network::TransportSocketOptionsConstSharedPtr& transport_socket_options, - Envoy::TimeSource& time_source, Envoy::Upstream::ClusterConnectivityState& state) override { + Envoy::TimeSource& time_source, Envoy::Upstream::ClusterConnectivityState& state, + Envoy::Http::PersistentQuicInfoPtr& quic_info) override { // This changed in // https://github.com/envoyproxy/envoy/commit/93ee668a690d297ab5e8bd2cbf03771d852ebbda ALPN may // be set up to negotiate a protocol, in which case we'd need a HttpConnPoolImplMixed. However, @@ -206,7 +207,7 @@ class ClusterManagerFactory : public Envoy::Upstream::ProdClusterManagerFactory } return Envoy::Upstream::ProdClusterManagerFactory::allocateConnPool( dispatcher, host, priority, protocols, alternate_protocol_options, options, - transport_socket_options, time_source, state); + transport_socket_options, time_source, state, quic_info); } void setConnectionReuseStrategy( diff --git a/test/test_data/percentile-column-overflow.txt.gold b/test/test_data/percentile-column-overflow.txt.gold index 8e57fbe71..e6f7d58de 100644 --- a/test/test_data/percentile-column-overflow.txt.gold +++ b/test/test_data/percentile-column-overflow.txt.gold @@ -1,7 +1,7 @@ Nighthawk - A layer 7 protocol benchmarking tool. foo (1 samples) - min: 0 | mean: 0.0 | max: 0 | pstdev: 0.0 + min: 0 | mean: 0 | max: 0 | pstdev: 0 Percentile Count Value 0.99931641 1 0s 000ms 000us From 77055a619d58b329a8a15e5d751110c4611c0b55 Mon Sep 17 00:00:00 2001 From: qqustc Date: Tue, 29 Mar 2022 00:50:13 -0400 Subject: [PATCH 5/8] Update Envoy to 47d09cc (#823) - Update the `ENVOY_COMMIT` and `ENVOY_SHA` in bazel/repositories.bzl - .bazelrc already in sync Signed-off-by: qqustc --- bazel/repositories.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 9c1fe696b..0714dec27 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 = "ad9434b0ca7740deb48f556cfb7097b40b6e625c" # Mar 21, 2022 -ENVOY_SHA = "546f13a22250eabe83ef1b07b6d58e7b20bf71869e9ad10b48990ccd3a6172b7" +ENVOY_COMMIT = "47d09cc6a6717988e4c6294cbaebaa7bf714e6b1" # Mar 28, 2022 +ENVOY_SHA = "16dd196f3007985e66abbc107f41368485ef14e23905ac4f4683fc29243b86ef" HDR_HISTOGRAM_C_VERSION = "0.11.2" # October 12th, 2020 HDR_HISTOGRAM_C_SHA = "637f28b5f64de2e268131e4e34e6eef0b91cf5ff99167db447d9b2825eae6bad" From a2474933e0f4913d9c1adc24330d0dacbebb9fcd Mon Sep 17 00:00:00 2001 From: Jakub Sobon Date: Thu, 31 Mar 2022 10:21:13 -0400 Subject: [PATCH 6/8] Defining our first Azure Pipeline. (#821) This is first of a few PRs that will migrate Nighthawk's CI to Azure Pipelines. This is what Envoy uses currently and this is where we can get more resources which will enable the integration tests to pass again. This defines a single step `build` that will execute in our `nighthawk-presubmit` pipeline. Works on #820. Signed-off-by: Jakub Sobon --- .azure-pipelines/bazel.yml | 23 +++++++++++++++++++++++ .azure-pipelines/pipelines.yml | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .azure-pipelines/bazel.yml create mode 100644 .azure-pipelines/pipelines.yml diff --git a/.azure-pipelines/bazel.yml b/.azure-pipelines/bazel.yml new file mode 100644 index 000000000..2024de16c --- /dev/null +++ b/.azure-pipelines/bazel.yml @@ -0,0 +1,23 @@ +parameters: +- name: ciTarget + displayName: "CI target" + type: string + default: build + +steps: +- bash: | + echo "disk space at beginning of build:" + df -h + displayName: "Check disk space at beginning" + +- script: ci/run_envoy_docker.sh 'ci/do_ci.sh ${{ parameters.ciTarget }}' + workingDirectory: $(Build.SourcesDirectory) + displayName: "Run the CI script" + +- bash: | + echo "disk space at end of build:" + df -h + # Cleanup offending files with unicode names + rm -rf $(Build.StagingDirectory)/tmp/*/*/external/go_sdk/test/fixedbugs + displayName: "Check disk space at end" + condition: always() diff --git a/.azure-pipelines/pipelines.yml b/.azure-pipelines/pipelines.yml new file mode 100644 index 000000000..c25b387b6 --- /dev/null +++ b/.azure-pipelines/pipelines.yml @@ -0,0 +1,23 @@ +trigger: + branches: + include: + - "main" + +stages: +- stage: check + dependsOn: [] + jobs: + - job: bazel + displayName: "do_ci.sh" + dependsOn: [] + strategy: + maxParallel: 1 + matrix: + build: + CI_TARGET: "build" + timeoutInMinutes: 120 + pool: "x64-large" + steps: + - template: bazel.yml + parameters: + ciTarget: $(CI_TARGET) From dce4418e4d37ac2c2d65b7ac59ce0799d089bd8b Mon Sep 17 00:00:00 2001 From: tomjzzhang <4367421+tomjzzhang@users.noreply.github.com> Date: Tue, 5 Apr 2022 14:00:04 -0400 Subject: [PATCH 7/8] Update Envoy to 8cf3a2b (Apr 4th 2022) (#824) - Update the `ENVOY_COMMIT` and `ENVOY_SHA` in bazel/repositories.bzl - Update .bazelrc Signed-off-by: tomjzzhang <4367421+tomjzzhang@users.noreply.github.com> --- .bazelrc | 3 +++ bazel/repositories.bzl | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index 153f26cbf..95f405560 100644 --- a/.bazelrc +++ b/.bazelrc @@ -53,6 +53,9 @@ build --action_env=CXX build --action_env=LLVM_CONFIG build --action_env=PATH +# Disable ICU linking for googleurl. +build --@com_googlesource_googleurl//build_config:system_icu=0 + # Common flags for sanitizers build:sanitizer --define tcmalloc=disabled build:sanitizer --linkopt -ldl diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 0714dec27..7ecba89ff 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 = "47d09cc6a6717988e4c6294cbaebaa7bf714e6b1" # Mar 28, 2022 -ENVOY_SHA = "16dd196f3007985e66abbc107f41368485ef14e23905ac4f4683fc29243b86ef" +ENVOY_COMMIT = "8cf3a2b9f619f5ca5650a40fb325d6d552ceb8ec" # Apr 4, 2022 +ENVOY_SHA = "0423ea507c6bc65d266657c96a97a4c8950f3136130332717e4c600379fd5234" HDR_HISTOGRAM_C_VERSION = "0.11.2" # October 12th, 2020 HDR_HISTOGRAM_C_SHA = "637f28b5f64de2e268131e4e34e6eef0b91cf5ff99167db447d9b2825eae6bad" From 5f72e3d9315c0fb152f65c1c154ee4beb96ceb52 Mon Sep 17 00:00:00 2001 From: Jakub Sobon Date: Fri, 8 Apr 2022 11:20:24 -0400 Subject: [PATCH 8/8] Adding the test step into AZP (#825) Also enabling local bazel cache to carry state between the CI steps and printing out the full bazel command line for debugging. Works on #820. Signed-off-by: Jakub Sobon --- .azure-pipelines/bazel.yml | 2 ++ .azure-pipelines/pipelines.yml | 2 ++ ci/do_ci.sh | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/bazel.yml b/.azure-pipelines/bazel.yml index 2024de16c..e284ed301 100644 --- a/.azure-pipelines/bazel.yml +++ b/.azure-pipelines/bazel.yml @@ -13,6 +13,8 @@ steps: - script: ci/run_envoy_docker.sh 'ci/do_ci.sh ${{ parameters.ciTarget }}' workingDirectory: $(Build.SourcesDirectory) displayName: "Run the CI script" + env: + BAZEL_REMOTE_CACHE: $(LocalBuildCache) - bash: | echo "disk space at end of build:" diff --git a/.azure-pipelines/pipelines.yml b/.azure-pipelines/pipelines.yml index c25b387b6..b47cdb763 100644 --- a/.azure-pipelines/pipelines.yml +++ b/.azure-pipelines/pipelines.yml @@ -15,6 +15,8 @@ stages: matrix: build: CI_TARGET: "build" + test: + CI_TARGET: "test" timeoutInMinutes: 120 pool: "x64-large" steps: diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 4a2726cb0..61682985b 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -18,6 +18,7 @@ export BAZEL_BUILD_EXTRA_OPTIONS=${BAZEL_BUILD_EXTRA_OPTIONS:=""} export SRCDIR=${SRCDIR:="${PWD}"} export CLANG_FORMAT=clang-format export NIGHTHAWK_BUILD_ARCH=$(uname -m) +export BAZEL_REMOTE_CACHE=${BAZEL_REMOTE_CACHE:=""} # We build in steps to avoid running out of memory in CI. # This list doesn't have to be complete, execution of bazel test will build any @@ -219,6 +220,10 @@ if grep 'docker\|lxc' /proc/1/cgroup; then export BAZEL="bazel" fi +if [ -n "${BAZEL_REMOTE_CACHE}" ]; then + export BAZEL_BUILD_EXTRA_OPTIONS="${BAZEL_BUILD_EXTRA_OPTIONS} --remote_cache=${BAZEL_REMOTE_CACHE}" +fi + export BAZEL_EXTRA_TEST_OPTIONS="--test_env=ENVOY_IP_TEST_VERSIONS=v4only ${BAZEL_EXTRA_TEST_OPTIONS}" export BAZEL_BUILD_OPTIONS=" \ --verbose_failures ${BAZEL_OPTIONS} --action_env=HOME --action_env=PYTHONUSERBASE \ @@ -236,9 +241,9 @@ if [ -n "$CIRCLECI" ]; then BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} \ --discard_analysis_cache --notrack_incremental_state --nokeep_state_after_build" fi - echo "Running with ${NUM_CPUS} cpus and BAZEL_BUILD_OPTIONS: ${BAZEL_BUILD_OPTIONS}" BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --jobs=${NUM_CPUS}" fi +echo "Running with ${NUM_CPUS} cpus and BAZEL_BUILD_OPTIONS: ${BAZEL_BUILD_OPTIONS}" export BAZEL_TEST_OPTIONS="${BAZEL_BUILD_OPTIONS} --test_env=HOME --test_env=PYTHONUSERBASE \ --test_env=UBSAN_OPTIONS=print_stacktrace=1 \