From 85dc3d4ef6e37e85701aa0312a0ed5d00574a70b Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Mon, 6 Apr 2020 13:04:00 +0200 Subject: [PATCH 01/20] Update Envoy to 4c26d6ea3d60a1d3720c6e0cfe5a04563d4bd141 - Trace id generation broke. This was amended by directly using the new request id uid implementation. It would be nice to leverage the new request id extension capability later for this. - Amended calls to get counters by name - Synced .bazelrc - Amended test expectations for response size histograms which now report in with '.0' postfixed. Signed-off-by: Otto van der Schaaf --- .bazelrc | 13 ++++++++--- bazel/repositories.bzl | 4 ++-- source/client/BUILD | 2 +- source/client/benchmark_client_impl.cc | 4 +--- source/client/factories_impl.cc | 2 +- source/client/stream_decoder.cc | 9 +++---- source/client/stream_decoder.h | 11 +++++---- test/benchmark_http_client_test.cc | 2 +- test/stream_decoder_test.cc | 26 +++++++-------------- test/test_data/output_formatter.dotted.gold | 24 +++++++++---------- test/test_data/output_formatter.txt.gold | 4 ++-- test/utility_test.cc | 6 ++--- 12 files changed, 53 insertions(+), 54 deletions(-) diff --git a/.bazelrc b/.bazelrc index 2b2fce664..7f83d8173 100644 --- a/.bazelrc +++ b/.bazelrc @@ -16,7 +16,7 @@ startup --host_jvm_args=-Xmx2g build --workspace_status_command=bazel/get_workspace_status build --experimental_local_memory_estimate build --experimental_strict_action_env=true -build --host_force_python=PY2 +build --host_force_python=PY3 build --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a build --action_env=BAZEL_LINKOPTS=-lm build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11 @@ -162,7 +162,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:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f +build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:ebf534b8aa505e8ff5663a31eed782942a742ae4d656b54f4236b00399f17911 build:docker-sandbox --spawn_strategy=docker build:docker-sandbox --strategy=Javac=docker build:docker-sandbox --strategy=Closure=docker @@ -201,5 +201,12 @@ build:plain-fuzzer --define=FUZZING_ENGINE=libfuzzer build:plain-fuzzer --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION build:plain-fuzzer --copt=-fsanitize=fuzzer-no-link +# Compile database generation config +# We don't care about built binaries so always strip and use fastbuild. +build:compdb -c fastbuild +build:compdb --strip=always +build:compdb --build_tag_filters=-nocompdb +build:compdb --define=ENVOY_CONFIG_COMPILATION_DATABASE=1 + try-import %workspace%/clang.bazelrc -try-import %workspace%/user.bazelrc +try-import %workspace%/user.bazelrc \ No newline at end of file diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index bc3952b06..cda5697b9 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 = "631a009406c15c778a5571cde99eb8a3039ba7b1" # March 26th, 2020 -ENVOY_SHA = "926fb5875b88a82b58653b6511129aaa5665ab04e1deb70d3afc9ad99866744d" +ENVOY_COMMIT = "4c26d6ea3d60a1d3720c6e0cfe5a04563d4bd141" # April 6th, 2020 +ENVOY_SHA = "c5b8c949124a052e1ad702c900705f723797bedfccb16d49310622fbbae2851e" RULES_PYTHON_COMMIT = "dd7f9c5f01bafbfea08c44092b6b0c8fc8fcb77f" # Feb 22nd, 2020 RULES_PYTHON_SHA = "0aa9ec790a58053e3ab5af397879b267a625955f8297c239b2d8559c6773397b" diff --git a/source/client/BUILD b/source/client/BUILD index b3235b9e1..3d65f3640 100644 --- a/source/client/BUILD +++ b/source/client/BUILD @@ -66,7 +66,6 @@ envoy_cc_library( "@envoy//source/common/protobuf:message_validator_lib_with_external_headers", "@envoy//source/common/protobuf:utility_lib_with_external_headers", "@envoy//source/common/runtime:runtime_lib_with_external_headers", - "@envoy//source/common/runtime:uuid_util_lib_with_external_headers", "@envoy//source/common/secret:secret_manager_impl_lib_with_external_headers", "@envoy//source/common/singleton:manager_impl_lib_with_external_headers", "@envoy//source/common/stats:allocator_lib_with_external_headers", @@ -80,6 +79,7 @@ envoy_cc_library( "@envoy//source/exe:platform_header_lib_with_external_headers", "@envoy//source/exe:platform_impl_lib", "@envoy//source/exe:process_wide_lib_with_external_headers", + "@envoy//source/common/http:request_id_extension_lib_with_external_headers", "@envoy//source/extensions/tracers:well_known_names_with_external_headers", "@envoy//source/extensions/transport_sockets:well_known_names_with_external_headers", "@envoy//source/extensions/transport_sockets/tls:context_lib_with_external_headers", diff --git a/source/client/benchmark_client_impl.cc b/source/client/benchmark_client_impl.cc index 6b816bc00..99b5a3a65 100644 --- a/source/client/benchmark_client_impl.cc +++ b/source/client/benchmark_client_impl.cc @@ -9,7 +9,6 @@ #include "external/envoy/source/common/http/headers.h" #include "external/envoy/source/common/http/utility.h" #include "external/envoy/source/common/network/utility.h" -#include "external/envoy/source/common/runtime/uuid_util.h" #include "client/stream_decoder.h" @@ -161,12 +160,11 @@ bool BenchmarkClientHttpImpl::tryStartRequest(CompletionCallback caller_completi } } - std::string x_request_id = generator_.uuid(); auto stream_decoder = new StreamDecoder( dispatcher_, api_.timeSource(), *this, std::move(caller_completion_callback), *connect_statistic_, *response_statistic_, *response_header_size_statistic_, *response_body_size_statistic_, request->header(), shouldMeasureLatencies(), content_length, - x_request_id, http_tracer_); + generator_, http_tracer_); requests_initiated_++; pool_ptr->newStream(*stream_decoder, *stream_decoder); return true; diff --git a/source/client/factories_impl.cc b/source/client/factories_impl.cc index fe8516cc4..e65111f01 100644 --- a/source/client/factories_impl.cc +++ b/source/client/factories_impl.cc @@ -196,7 +196,7 @@ TerminationPredicate* TerminationPredicateFactoryImpl::linkConfiguredPredicates( predicate.first, predicate.second); current_predicate = ¤t_predicate->link( std::make_unique( - scope.counter(predicate.first), predicate.second, termination_status)); + scope.counterFromString(predicate.first), predicate.second, termination_status)); } return current_predicate; } diff --git a/source/client/stream_decoder.cc b/source/client/stream_decoder.cc index b9220a0c3..afdfd367d 100644 --- a/source/client/stream_decoder.cc +++ b/source/client/stream_decoder.cc @@ -3,6 +3,7 @@ #include #include "external/envoy/source/common/http/http1/codec_impl.h" +#include "external/envoy/source/common/http/request_id_extension_uuid_impl.h" #include "external/envoy/source/common/http/utility.h" #include "external/envoy/source/common/network/address_impl.h" #include "external/envoy/source/common/stream_info/stream_info_impl.h" @@ -134,13 +135,13 @@ void StreamDecoder::finalizeActiveSpan() { } } -void StreamDecoder::setupForTracing(std::string& x_request_id) { +void StreamDecoder::setupForTracing() { auto headers_copy = std::make_unique(); Envoy::Http::HeaderMapImpl::copyFrom(*headers_copy, *request_headers_); Envoy::Tracing::Decision tracing_decision = {Envoy::Tracing::Reason::ClientForced, true}; - RELEASE_ASSERT(Envoy::UuidUtils::setTraceableUuid(x_request_id, Envoy::UuidTraceStatus::Client), - "setTraceableUuid failed"); - headers_copy->setClientTraceId(x_request_id); + Envoy::Http::UUIDRequestIDExtension uuid_generator(random_generator_); + uuid_generator.set(*headers_copy, true); + uuid_generator.setTraceStatus(*headers_copy, Envoy::Http::TraceStatus::Client); active_span_ = http_tracer_->startSpan(config_, *headers_copy, stream_info_, tracing_decision); active_span_->injectContext(*headers_copy); request_headers_.reset(headers_copy.release()); diff --git a/source/client/stream_decoder.h b/source/client/stream_decoder.h index 9608bbc66..869a8d57e 100644 --- a/source/client/stream_decoder.h +++ b/source/client/stream_decoder.h @@ -13,7 +13,6 @@ #include "nighthawk/common/statistic.h" #include "external/envoy/source/common/http/header_map_impl.h" -#include "external/envoy/source/common/runtime/uuid_util.h" #include "external/envoy/source/common/stream_info/stream_info_impl.h" #include "external/envoy/source/common/tracing/http_tracer_impl.h" @@ -42,7 +41,8 @@ class StreamDecoder : public Envoy::Http::ResponseDecoder, OperationCallback caller_completion_callback, Statistic& connect_statistic, Statistic& latency_statistic, Statistic& response_header_sizes_statistic, Statistic& response_body_sizes_statistic, HeaderMapPtr request_headers, - bool measure_latencies, uint32_t request_body_size, std::string x_request_id, + bool measure_latencies, uint32_t request_body_size, + Envoy::Runtime::RandomGenerator& random_generator, Envoy::Tracing::HttpTracerSharedPtr& http_tracer) : dispatcher_(dispatcher), time_source_(time_source), decoder_completion_callback_(decoder_completion_callback), @@ -53,9 +53,9 @@ class StreamDecoder : public Envoy::Http::ResponseDecoder, request_headers_(std::move(request_headers)), connect_start_(time_source_.monotonicTime()), complete_(false), measure_latencies_(measure_latencies), request_body_size_(request_body_size), stream_info_(time_source_), - http_tracer_(http_tracer) { + random_generator_(random_generator), http_tracer_(http_tracer) { if (measure_latencies_ && http_tracer_ != nullptr) { - setupForTracing(x_request_id); + setupForTracing(); } } @@ -83,7 +83,7 @@ class StreamDecoder : public Envoy::Http::ResponseDecoder, static Envoy::StreamInfo::ResponseFlag streamResetReasonToResponseFlag(Envoy::Http::StreamResetReason reset_reason); void finalizeActiveSpan(); - void setupForTracing(std::string& x_request_id); + void setupForTracing(); private: void onComplete(bool success); @@ -110,6 +110,7 @@ class StreamDecoder : public Envoy::Http::ResponseDecoder, const uint32_t request_body_size_; Envoy::Tracing::EgressConfigImpl config_; Envoy::StreamInfo::StreamInfoImpl stream_info_; + Envoy::Runtime::RandomGenerator& random_generator_; Envoy::Tracing::HttpTracerSharedPtr& http_tracer_; Envoy::Tracing::SpanPtr active_span_; Envoy::StreamInfo::UpstreamTiming upstream_timing_; diff --git a/test/benchmark_http_client_test.cc b/test/benchmark_http_client_test.cc index ee70c66f2..8800588f6 100644 --- a/test/benchmark_http_client_test.cc +++ b/test/benchmark_http_client_test.cc @@ -128,7 +128,7 @@ class BenchmarkClientHttpTest : public Test { } uint64_t getCounter(absl::string_view name) { - return client_->scope().counter(std::string(name)).value(); + return client_->scope().counterFromString(std::string(name)).value(); } Envoy::Upstream::MockClusterManager& cluster_manager() { diff --git a/test/stream_decoder_test.cc b/test/stream_decoder_test.cc index b1703d01d..dd33cd053 100644 --- a/test/stream_decoder_test.cc +++ b/test/stream_decoder_test.cc @@ -20,11 +20,6 @@ using namespace testing; namespace Nighthawk { namespace Client { -namespace { -static const std::string TEST_TRACER_UID = "f4dca0a9-12c7-4307-8002-969403baf480"; -static const std::string TEST_TRACER_UID_BIT_SET = "f4dca0a9-12c7-b307-8002-969403baf480"; -} // namespace - class StreamDecoderTest : public Test, public StreamDecoderCompletionCallback { public: StreamDecoderTest() @@ -53,6 +48,7 @@ class StreamDecoderTest : public Test, public StreamDecoderCompletionCallback { HeaderMapPtr request_headers_; uint64_t stream_decoder_completion_callbacks_{0}; uint64_t pool_failures_{0}; + Envoy::Runtime::RandomGeneratorImpl random_generator_; Envoy::Tracing::HttpTracerSharedPtr http_tracer_; Envoy::Http::ResponseHeaderMapPtr test_header_; Envoy::Http::ResponseTrailerMapPtr test_trailer_; @@ -63,7 +59,7 @@ TEST_F(StreamDecoderTest, HeaderOnlyTest) { auto decoder = new StreamDecoder( *dispatcher_, time_system_, *this, [&is_complete](bool, bool) { is_complete = true; }, connect_statistic_, latency_statistic_, response_header_size_statistic_, - response_body_size_statistic_, request_headers_, false, 0, TEST_TRACER_UID, http_tracer_); + response_body_size_statistic_, request_headers_, false, 0, random_generator_, http_tracer_); decoder->decodeHeaders(std::move(test_header_), true); EXPECT_TRUE(is_complete); EXPECT_EQ(1, stream_decoder_completion_callbacks_); @@ -74,7 +70,7 @@ TEST_F(StreamDecoderTest, HeaderWithBodyTest) { auto decoder = new StreamDecoder( *dispatcher_, time_system_, *this, [&is_complete](bool, bool) { is_complete = true; }, connect_statistic_, latency_statistic_, response_header_size_statistic_, - response_body_size_statistic_, request_headers_, false, 0, TEST_TRACER_UID, http_tracer_); + response_body_size_statistic_, request_headers_, false, 0, random_generator_, http_tracer_); decoder->decodeHeaders(std::move(test_header_), false); EXPECT_FALSE(is_complete); Envoy::Buffer::OwnedImpl buf(std::string(1, 'a')); @@ -90,7 +86,7 @@ TEST_F(StreamDecoderTest, TrailerTest) { auto decoder = new StreamDecoder( *dispatcher_, time_system_, *this, [&is_complete](bool, bool) { is_complete = true; }, connect_statistic_, latency_statistic_, response_header_size_statistic_, - response_body_size_statistic_, request_headers_, false, 0, TEST_TRACER_UID, http_tracer_); + response_body_size_statistic_, request_headers_, false, 0, random_generator_, http_tracer_); Envoy::Http::ResponseHeaderMapPtr headers{ new Envoy::Http::TestResponseHeaderMapImpl{{":status", "200"}}}; decoder->decodeHeaders(std::move(headers), false); @@ -104,7 +100,7 @@ TEST_F(StreamDecoderTest, LatencyIsNotMeasured) { auto decoder = new StreamDecoder( *dispatcher_, time_system_, *this, [](bool, bool) {}, connect_statistic_, latency_statistic_, response_header_size_statistic_, response_body_size_statistic_, request_headers_, false, 0, - TEST_TRACER_UID, http_tracer_); + random_generator_, http_tracer_); Envoy::Http::MockRequestEncoder stream_encoder; EXPECT_CALL(stream_encoder, getStream()); Envoy::Upstream::HostDescriptionConstSharedPtr ptr; @@ -136,20 +132,16 @@ TEST_F(StreamDecoderTest, LatencyIsMeasured) { auto request_header = std::make_shared( std::initializer_list>( {{":method", "GET"}, {":path", "/"}})); - auto expected_request_header = std::make_shared( - std::initializer_list>( - {{":method", "GET"}, {":path", "/"}, {"x-client-trace-id", TEST_TRACER_UID_BIT_SET}})); auto decoder = new StreamDecoder( *dispatcher_, time_system_, *this, [](bool, bool) {}, connect_statistic_, latency_statistic_, response_header_size_statistic_, response_body_size_statistic_, request_header, true, 0, - TEST_TRACER_UID, http_tracer_); + random_generator_, http_tracer_); Envoy::Http::MockRequestEncoder stream_encoder; EXPECT_CALL(stream_encoder, getStream()); Envoy::Upstream::HostDescriptionConstSharedPtr ptr; NiceMock stream_info; - EXPECT_CALL(stream_encoder, - encodeHeaders(Envoy::HeaderMapEqualRef(expected_request_header.get()), true)); + EXPECT_CALL(stream_encoder, encodeHeaders(_, true)); decoder->onPoolReady(stream_encoder, ptr, stream_info); EXPECT_EQ(1, connect_statistic_.count()); decoder->decodeHeaders(std::move(test_header_), false); @@ -163,7 +155,7 @@ TEST_F(StreamDecoderTest, StreamResetTest) { auto decoder = new StreamDecoder( *dispatcher_, time_system_, *this, [&is_complete](bool, bool) { is_complete = true; }, connect_statistic_, latency_statistic_, response_header_size_statistic_, - response_body_size_statistic_, request_headers_, false, 0, TEST_TRACER_UID, http_tracer_); + response_body_size_statistic_, request_headers_, false, 0, random_generator_, http_tracer_); decoder->decodeHeaders(std::move(test_header_), false); decoder->onResetStream(Envoy::Http::StreamResetReason::LocalReset, "fooreason"); EXPECT_TRUE(is_complete); // these do get reported. @@ -175,7 +167,7 @@ TEST_F(StreamDecoderTest, PoolFailureTest) { auto decoder = new StreamDecoder( *dispatcher_, time_system_, *this, [&is_complete](bool, bool) { is_complete = true; }, connect_statistic_, latency_statistic_, response_header_size_statistic_, - response_body_size_statistic_, request_headers_, false, 0, TEST_TRACER_UID, http_tracer_); + response_body_size_statistic_, request_headers_, false, 0, random_generator_, http_tracer_); Envoy::Upstream::HostDescriptionConstSharedPtr ptr; decoder->onPoolFailure(Envoy::Http::ConnectionPool::PoolFailureReason::Overflow, "fooreason", ptr); diff --git a/test/test_data/output_formatter.dotted.gold b/test/test_data/output_formatter.dotted.gold index 43152655a..0c5a635fc 100644 --- a/test/test_data/output_formatter.dotted.gold +++ b/test/test_data/output_formatter.dotted.gold @@ -14,13 +14,13 @@ worker_0.foo_size.pstdev: 1.11803 worker_0.foo_size.min: 14 worker_0.foo_size.max: 17 worker_0.foo_size.permilles-0.count: 1 -worker_0.foo_size.permilles-0.value: 14 +worker_0.foo_size.permilles-0.value: 14.0 worker_0.foo_size.permilles-500.count: 2 -worker_0.foo_size.permilles-500.value: 15 +worker_0.foo_size.permilles-500.value: 15.0 worker_0.foo_size.permilles-750.count: 3 -worker_0.foo_size.permilles-750.value: 16 +worker_0.foo_size.permilles-750.value: 16.0 worker_0.foo_size.permilles-1000.count: 4 -worker_0.foo_size.permilles-1000.value: 17 +worker_0.foo_size.permilles-1000.value: 17.0 worker_0.foo_latency.samples: 4 worker_0.foo_latency.mean: 195 worker_0.foo_latency.pstdev: 11 @@ -52,13 +52,13 @@ worker_1.foo_size.pstdev: 1.11803 worker_1.foo_size.min: 14 worker_1.foo_size.max: 17 worker_1.foo_size.permilles-0.count: 1 -worker_1.foo_size.permilles-0.value: 14 +worker_1.foo_size.permilles-0.value: 14.0 worker_1.foo_size.permilles-500.count: 2 -worker_1.foo_size.permilles-500.value: 15 +worker_1.foo_size.permilles-500.value: 15.0 worker_1.foo_size.permilles-750.count: 3 -worker_1.foo_size.permilles-750.value: 16 +worker_1.foo_size.permilles-750.value: 16.0 worker_1.foo_size.permilles-1000.count: 4 -worker_1.foo_size.permilles-1000.value: 17 +worker_1.foo_size.permilles-1000.value: 17.0 worker_1.foo_latency.samples: 4 worker_1.foo_latency.mean: 195 worker_1.foo_latency.pstdev: 11 @@ -90,13 +90,13 @@ global.foo_size.pstdev: 1.11803 global.foo_size.min: 14 global.foo_size.max: 17 global.foo_size.permilles-0.count: 1 -global.foo_size.permilles-0.value: 14 +global.foo_size.permilles-0.value: 14.0 global.foo_size.permilles-500.count: 2 -global.foo_size.permilles-500.value: 15 +global.foo_size.permilles-500.value: 15.0 global.foo_size.permilles-750.count: 3 -global.foo_size.permilles-750.value: 16 +global.foo_size.permilles-750.value: 16.0 global.foo_size.permilles-1000.count: 4 -global.foo_size.permilles-1000.value: 17 +global.foo_size.permilles-1000.value: 17.0 global.foo_latency.samples: 4 global.foo_latency.mean: 195 global.foo_latency.pstdev: 11 diff --git a/test/test_data/output_formatter.txt.gold b/test/test_data/output_formatter.txt.gold index b9b99f8f9..6e419d07e 100644 --- a/test/test_data/output_formatter.txt.gold +++ b/test/test_data/output_formatter.txt.gold @@ -7,8 +7,8 @@ foo_size (4 samples) min: 14 | mean: 15.5 | max: 17 | pstdev: 1.11803 Percentile Count Value - 0.5 2 15 - 0.75 3 16 + 0.5 2 15.0 + 0.75 3 16.0 foo_latency (4 samples) min: 0s 000ms 180us | mean: 0s 000ms 195us | max: 0s 000ms 210us | pstdev: 0s 000ms 011us diff --git a/test/utility_test.cc b/test/utility_test.cc index 7246c6191..7ec2fb414 100644 --- a/test/utility_test.cc +++ b/test/utility_test.cc @@ -163,9 +163,9 @@ TEST_F(UtilityTest, TranslateAddressFamilyGoodValues) { TEST_F(UtilityTest, MapCountersFromStore) { Envoy::Stats::IsolatedStoreImpl store; - store.counter("foo").inc(); - store.counter("worker.2.bar").inc(); - store.counter("worker.1.bar").inc(); + store.counterFromString("foo").inc(); + store.counterFromString("worker.2.bar").inc(); + store.counterFromString("worker.1.bar").inc(); uint64_t filter_delegate_hit_count = 0; const auto& counters = Utility().mapCountersFromStore( store, [&filter_delegate_hit_count](absl::string_view name, uint64_t value) { From 6d0b8143a2d79656b3aed0213ac11b8fa73d05f5 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Tue, 7 Apr 2020 17:14:31 +0200 Subject: [PATCH 02/20] Update Envoy to 549164c42cae84b59154ca4c36009e408aa10b52 Signed-off-by: Otto van der Schaaf --- bazel/repositories.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index cda5697b9..33eb356d2 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 = "4c26d6ea3d60a1d3720c6e0cfe5a04563d4bd141" # April 6th, 2020 -ENVOY_SHA = "c5b8c949124a052e1ad702c900705f723797bedfccb16d49310622fbbae2851e" +ENVOY_COMMIT = "549164c42cae84b59154ca4c36009e408aa10b52" # April 7th, 2020 +ENVOY_SHA = "3082712de081a0d25f822292bb879d1f71e5d7b7b1696661885677b09abf9b56" RULES_PYTHON_COMMIT = "dd7f9c5f01bafbfea08c44092b6b0c8fc8fcb77f" # Feb 22nd, 2020 RULES_PYTHON_SHA = "0aa9ec790a58053e3ab5af397879b267a625955f8297c239b2d8559c6773397b" From 353a0710469d32920f958a229b690fa7cfeee383 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Wed, 8 Apr 2020 09:22:28 +0200 Subject: [PATCH 03/20] Update Envoy to 4b6e81c112e204ef04445318d2cbfa168cf22ca7 Signed-off-by: Otto van der Schaaf --- bazel/repositories.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 33eb356d2..f5f15c31e 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 = "549164c42cae84b59154ca4c36009e408aa10b52" # April 7th, 2020 -ENVOY_SHA = "3082712de081a0d25f822292bb879d1f71e5d7b7b1696661885677b09abf9b56" +ENVOY_COMMIT = "4b6e81c112e204ef04445318d2cbfa168cf22ca7" # April 8th, 2020 +ENVOY_SHA = "a9b8c6816be03f48cfe54dfe9e2bcd976e23b009225227e658c30b12a619485a" RULES_PYTHON_COMMIT = "dd7f9c5f01bafbfea08c44092b6b0c8fc8fcb77f" # Feb 22nd, 2020 RULES_PYTHON_SHA = "0aa9ec790a58053e3ab5af397879b267a625955f8297c239b2d8559c6773397b" From 6acd594dd5b14c2f6d04c3d5e903afab589aafc3 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Wed, 8 Apr 2020 10:02:30 +0200 Subject: [PATCH 04/20] Add .bazelversion, pin to 2.2.0 like Envoy does Signed-off-by: Otto van der Schaaf --- .bazelversion | 1 + 1 file changed, 1 insertion(+) create mode 100644 .bazelversion diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 000000000..ccbccc3dc --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +2.2.0 From ada117235825c0c5984fabd87c3fa0d4787e1a2c Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Wed, 8 Apr 2020 12:24:39 +0200 Subject: [PATCH 05/20] do_ci.sh: add --build_tests_only for asan/tsan Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 6670fb9f5..16b67cb97 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -74,18 +74,18 @@ function do_asan() { echo "Building and testing envoy tests..." cd "${SRCDIR}" # We build this in steps to avoid running out of memory in CI - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/exe/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... - run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan //test/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan -- //source/exe/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan -- //source/server/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan -- //test/mocks/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan -- //test/... + run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan //test/... } function do_tsan() { echo "bazel TSAN debug build with tests" echo "Building and testing envoy tests..." cd "${SRCDIR}" - run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-tsan //test/... + run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-tsan //test/... } function do_check_format() { From 0bf82a1290626ef180a986429b3466af40330446 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Wed, 8 Apr 2020 13:12:49 +0200 Subject: [PATCH 06/20] asan: split up into more build steps Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 16b67cb97..daa93cca3 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -74,10 +74,12 @@ function do_asan() { echo "Building and testing envoy tests..." cd "${SRCDIR}" # We build this in steps to avoid running out of memory in CI - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan -- //source/exe/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan -- //source/server/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan -- //test/mocks/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan -- //test/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/common/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/client/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/exe/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan //test/... } From 9b9aa41e22afcf1f12835149befd0bf9455293cf Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Wed, 8 Apr 2020 13:53:58 +0200 Subject: [PATCH 07/20] ci/asan: reduce parallellism in CI Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index daa93cca3..1fb48a395 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -184,6 +184,10 @@ case "$1" in exit 0 ;; asan) + if [ -n "$CIRCLECI" ]; then + # Decrease parallelism to avoid running out of memory + NUM_CPUS=6 + fi do_asan exit 0 ;; From 704a370b7918deb87e897bea52457e2755d6ea97 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Wed, 8 Apr 2020 16:34:10 +0200 Subject: [PATCH 08/20] asan/ci: add --local_ram_resources=12288 in CI Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 1fb48a395..aa218807f 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -149,7 +149,8 @@ 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 \ ---jobs=${NUM_CPUS} --show_task_finish --experimental_generate_json_trace_profile ${BAZEL_BUILD_EXTRA_OPTIONS}" +--show_task_finish --experimental_generate_json_trace_profile ${BAZEL_BUILD_EXTRA_OPTIONS}" +[ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_ram_resources=12288 --jobs=${NUM_CPUS}" export BAZEL_TEST_OPTIONS="${BAZEL_BUILD_OPTIONS} --test_env=HOME --test_env=PYTHONUSERBASE \ --test_env=UBSAN_OPTIONS=print_stacktrace=1 \ --cache_test_results=no --test_output=all ${BAZEL_EXTRA_TEST_OPTIONS}" @@ -184,10 +185,6 @@ case "$1" in exit 0 ;; asan) - if [ -n "$CIRCLECI" ]; then - # Decrease parallelism to avoid running out of memory - NUM_CPUS=6 - fi do_asan exit 0 ;; From d1b809cfd57b08ed576c6969f1e795e2af923cad Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Wed, 8 Apr 2020 21:49:29 +0200 Subject: [PATCH 09/20] asan/ci: update Envoy to latest rev. Tweak parallellism attempt II Signed-off-by: Otto van der Schaaf --- bazel/repositories.bzl | 4 ++-- ci/do_ci.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index f5f15c31e..320abc2b8 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 = "4b6e81c112e204ef04445318d2cbfa168cf22ca7" # April 8th, 2020 -ENVOY_SHA = "a9b8c6816be03f48cfe54dfe9e2bcd976e23b009225227e658c30b12a619485a" +ENVOY_COMMIT = "f84440dc4f95890f14e2e0686b07258f030b54b3" # April 8th, 2020 +ENVOY_SHA = "200477ab552bcaf08415836a67b7e4de5727db42b5a967a3c4232f519fd03cf2" RULES_PYTHON_COMMIT = "dd7f9c5f01bafbfea08c44092b6b0c8fc8fcb77f" # Feb 22nd, 2020 RULES_PYTHON_SHA = "0aa9ec790a58053e3ab5af397879b267a625955f8297c239b2d8559c6773397b" diff --git a/ci/do_ci.sh b/ci/do_ci.sh index aa218807f..33ca3e64e 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -150,7 +150,6 @@ export BAZEL_EXTRA_TEST_OPTIONS="--test_env=ENVOY_IP_TEST_VERSIONS=v4only ${BAZE export BAZEL_BUILD_OPTIONS=" \ --verbose_failures ${BAZEL_OPTIONS} --action_env=HOME --action_env=PYTHONUSERBASE \ --show_task_finish --experimental_generate_json_trace_profile ${BAZEL_BUILD_EXTRA_OPTIONS}" -[ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_ram_resources=12288 --jobs=${NUM_CPUS}" export BAZEL_TEST_OPTIONS="${BAZEL_BUILD_OPTIONS} --test_env=HOME --test_env=PYTHONUSERBASE \ --test_env=UBSAN_OPTIONS=print_stacktrace=1 \ --cache_test_results=no --test_output=all ${BAZEL_EXTRA_TEST_OPTIONS}" @@ -185,6 +184,7 @@ case "$1" in exit 0 ;; asan) + [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_ram_resources=12288 --jobs=6" do_asan exit 0 ;; From 768c78bc03988cac9518daffe0f7cfaf5f5bd142 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Wed, 8 Apr 2020 22:24:53 +0200 Subject: [PATCH 10/20] ci/asan: up parallelism as now the ci job is timing out Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 33ca3e64e..d75fc367c 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -80,6 +80,7 @@ function do_asan() { run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... + [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_ram_resources=12288 --jobs=6" run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan //test/... } @@ -184,7 +185,6 @@ case "$1" in exit 0 ;; asan) - [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_ram_resources=12288 --jobs=6" do_asan exit 0 ;; From 3a1256275252ea49edc8e26a5391ca02a6ffa3a4 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 09:33:18 +0200 Subject: [PATCH 11/20] Revert some changes to do_ci.sh Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) mode change 100755 => 100644 ci/do_ci.sh diff --git a/ci/do_ci.sh b/ci/do_ci.sh old mode 100755 new mode 100644 index d75fc367c..6a4b87349 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -73,22 +73,21 @@ function do_asan() { echo "bazel ASAN/UBSAN debug build with tests" echo "Building and testing envoy tests..." cd "${SRCDIR}" + [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_TEST_OPTIONS} --local_ram_resources=12288" + # We build this in steps to avoid running out of memory in CI - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/common/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/client/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/exe/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... - [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_ram_resources=12288 --jobs=6" - run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-asan //test/... + run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=6 //test/... } function do_tsan() { echo "bazel TSAN debug build with tests" echo "Building and testing envoy tests..." cd "${SRCDIR}" - run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --build_tests_only --config=clang-tsan //test/... + run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-tsan //test/... } function do_check_format() { @@ -150,7 +149,7 @@ 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 \ ---show_task_finish --experimental_generate_json_trace_profile ${BAZEL_BUILD_EXTRA_OPTIONS}" +--jobs=${NUM_CPUS} --show_task_finish --experimental_generate_json_trace_profile ${BAZEL_BUILD_EXTRA_OPTIONS}" export BAZEL_TEST_OPTIONS="${BAZEL_BUILD_OPTIONS} --test_env=HOME --test_env=PYTHONUSERBASE \ --test_env=UBSAN_OPTIONS=print_stacktrace=1 \ --cache_test_results=no --test_output=all ${BAZEL_EXTRA_TEST_OPTIONS}" From 3f5581a0ffa739a55a66444ee284bc6cba30a393 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 09:36:10 +0200 Subject: [PATCH 12/20] Resture execution bit Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 ci/do_ci.sh diff --git a/ci/do_ci.sh b/ci/do_ci.sh old mode 100644 new mode 100755 From 9d8ea17cbb8fd2e1cc0ce6285bfc84a4b6f30b72 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 10:17:37 +0200 Subject: [PATCH 13/20] CI: asan/tsan parallelism Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 6a4b87349..c531e249a 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -80,13 +80,14 @@ function do_asan() { run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... - run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=6 //test/... + run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=4 //test/... } function do_tsan() { echo "bazel TSAN debug build with tests" echo "Building and testing envoy tests..." cd "${SRCDIR}" + [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_TEST_OPTIONS} --local_ram_resources=12288" run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-tsan //test/... } From 36a8c4e79547bcf900b0de5bcda57788bac029ce Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 11:12:17 +0200 Subject: [PATCH 14/20] Throttle back asan test concurrency further Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index c531e249a..83cdd7d70 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -80,7 +80,7 @@ function do_asan() { run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... - run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=4 //test/... + run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=2 //test/... } function do_tsan() { From 8d594f8a8c1178914d0359cedbe2ed0278eb030f Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 11:55:24 +0200 Subject: [PATCH 15/20] CI/asan: serialize testing Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 83cdd7d70..72e38f01b 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -80,7 +80,7 @@ function do_asan() { run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... - run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=2 //test/... + run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=1 //test/... } function do_tsan() { From 2cfdeaed9e55d1a4c21bf5bfdc5ee9b128290206 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 12:14:34 +0200 Subject: [PATCH 16/20] ci/asan: reduce parallelism in the integration tests Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 10 +++++----- test/integration/integration_test.py | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 72e38f01b..c0600588a 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -76,11 +76,11 @@ function do_asan() { [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_TEST_OPTIONS} --local_ram_resources=12288" # We build this in steps to avoid running out of memory in CI - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/exe/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... - run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... - run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=1 //test/... + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/exe/... && \ + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... && \ + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... && \ + run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... && \ + run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=6 //test/... } function do_tsan() { diff --git a/test/integration/integration_test.py b/test/integration/integration_test.py index 915b3cc6d..2309521a7 100644 --- a/test/integration/integration_test.py +++ b/test/integration/integration_test.py @@ -7,6 +7,8 @@ import sys import pytest +from utility import isSanitizerRun + if __name__ == '__main__': path = os.path.dirname(os.path.realpath(__file__)) test_selection_arg = sys.argv[1] if len(sys.argv) > 1 else "" @@ -22,7 +24,7 @@ "-x", path, "-n", - "20" # Number of tests to run in parallel + "2" if isSanitizerRun() else "20" # Number of tests to run in parallel ], plugins=["xdist"]) exit(r) From 80abd4f57eb8bffbebcaebc9b1e7f893e34bd469 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 12:54:09 +0200 Subject: [PATCH 17/20] Pinpoint floating point output formatting change and fix Output formatting subtly changed, probably because of an updated dependency brought in by the new Envoy revision. Use an explicit formatting directive to amend and ensure that stays put. This also backs out the updated expectations, cleaning up the diff. Signed-off-by: Otto van der Schaaf --- source/client/output_formatter_impl.cc | 7 +++--- test/test_data/output_formatter.dotted.gold | 24 ++++++++++----------- test/test_data/output_formatter.txt.gold | 4 ++-- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/source/client/output_formatter_impl.cc b/source/client/output_formatter_impl.cc index e5bc44cdc..2b6ef2cbf 100644 --- a/source/client/output_formatter_impl.cc +++ b/source/client/output_formatter_impl.cc @@ -91,8 +91,9 @@ std::string ConsoleOutputFormatterImpl::formatProto(const nighthawk::client::Out header_written = true; } ss << fmt::format(" {:<{}}{:<{}}{:<{}}", p, 12, percentile.count(), 12, - percentile.has_duration() ? formatProtoDuration(percentile.duration()) - : fmt::format("{}", percentile.raw_value()), + percentile.has_duration() + ? formatProtoDuration(percentile.duration()) + : fmt::format("{:.{}f}", percentile.raw_value(), 0), 15) << std::endl; } @@ -189,7 +190,7 @@ DottedStringOutputFormatterImpl::formatProto(const nighthawk::client::Output& ou "{}.microseconds: {}", percentile_prefix, Envoy::Protobuf::util::TimeUtil::DurationToMicroseconds(percentile.duration())); } else { - ss << fmt::format("{}.value: {}", percentile_prefix, percentile.raw_value()); + ss << fmt::format("{}.value: {:.{}f}", percentile_prefix, percentile.raw_value(), 0); } ss << std::endl; }); diff --git a/test/test_data/output_formatter.dotted.gold b/test/test_data/output_formatter.dotted.gold index 0c5a635fc..43152655a 100644 --- a/test/test_data/output_formatter.dotted.gold +++ b/test/test_data/output_formatter.dotted.gold @@ -14,13 +14,13 @@ worker_0.foo_size.pstdev: 1.11803 worker_0.foo_size.min: 14 worker_0.foo_size.max: 17 worker_0.foo_size.permilles-0.count: 1 -worker_0.foo_size.permilles-0.value: 14.0 +worker_0.foo_size.permilles-0.value: 14 worker_0.foo_size.permilles-500.count: 2 -worker_0.foo_size.permilles-500.value: 15.0 +worker_0.foo_size.permilles-500.value: 15 worker_0.foo_size.permilles-750.count: 3 -worker_0.foo_size.permilles-750.value: 16.0 +worker_0.foo_size.permilles-750.value: 16 worker_0.foo_size.permilles-1000.count: 4 -worker_0.foo_size.permilles-1000.value: 17.0 +worker_0.foo_size.permilles-1000.value: 17 worker_0.foo_latency.samples: 4 worker_0.foo_latency.mean: 195 worker_0.foo_latency.pstdev: 11 @@ -52,13 +52,13 @@ worker_1.foo_size.pstdev: 1.11803 worker_1.foo_size.min: 14 worker_1.foo_size.max: 17 worker_1.foo_size.permilles-0.count: 1 -worker_1.foo_size.permilles-0.value: 14.0 +worker_1.foo_size.permilles-0.value: 14 worker_1.foo_size.permilles-500.count: 2 -worker_1.foo_size.permilles-500.value: 15.0 +worker_1.foo_size.permilles-500.value: 15 worker_1.foo_size.permilles-750.count: 3 -worker_1.foo_size.permilles-750.value: 16.0 +worker_1.foo_size.permilles-750.value: 16 worker_1.foo_size.permilles-1000.count: 4 -worker_1.foo_size.permilles-1000.value: 17.0 +worker_1.foo_size.permilles-1000.value: 17 worker_1.foo_latency.samples: 4 worker_1.foo_latency.mean: 195 worker_1.foo_latency.pstdev: 11 @@ -90,13 +90,13 @@ global.foo_size.pstdev: 1.11803 global.foo_size.min: 14 global.foo_size.max: 17 global.foo_size.permilles-0.count: 1 -global.foo_size.permilles-0.value: 14.0 +global.foo_size.permilles-0.value: 14 global.foo_size.permilles-500.count: 2 -global.foo_size.permilles-500.value: 15.0 +global.foo_size.permilles-500.value: 15 global.foo_size.permilles-750.count: 3 -global.foo_size.permilles-750.value: 16.0 +global.foo_size.permilles-750.value: 16 global.foo_size.permilles-1000.count: 4 -global.foo_size.permilles-1000.value: 17.0 +global.foo_size.permilles-1000.value: 17 global.foo_latency.samples: 4 global.foo_latency.mean: 195 global.foo_latency.pstdev: 11 diff --git a/test/test_data/output_formatter.txt.gold b/test/test_data/output_formatter.txt.gold index 6e419d07e..b9b99f8f9 100644 --- a/test/test_data/output_formatter.txt.gold +++ b/test/test_data/output_formatter.txt.gold @@ -7,8 +7,8 @@ foo_size (4 samples) min: 14 | mean: 15.5 | max: 17 | pstdev: 1.11803 Percentile Count Value - 0.5 2 15.0 - 0.75 3 16.0 + 0.5 2 15 + 0.75 3 16 foo_latency (4 samples) min: 0s 000ms 180us | mean: 0s 000ms 195us | max: 0s 000ms 210us | pstdev: 0s 000ms 011us From 2087777870898f2181296df5f2064b44ff79864d Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 15:52:04 +0200 Subject: [PATCH 18/20] output formatting: static cast percentile values to int We want to avoid trailing '.0's in the output of percentile values. Effectively we want to represent integer values. So static cast the input to libfmt to int, instead of specifying a precision of 0. Signed-off-by: Otto van der Schaaf --- source/client/output_formatter_impl.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/client/output_formatter_impl.cc b/source/client/output_formatter_impl.cc index 2b6ef2cbf..726d3a87c 100644 --- a/source/client/output_formatter_impl.cc +++ b/source/client/output_formatter_impl.cc @@ -93,7 +93,7 @@ std::string ConsoleOutputFormatterImpl::formatProto(const nighthawk::client::Out ss << fmt::format(" {:<{}}{:<{}}{:<{}}", p, 12, percentile.count(), 12, percentile.has_duration() ? formatProtoDuration(percentile.duration()) - : fmt::format("{:.{}f}", percentile.raw_value(), 0), + : fmt::format("{}", static_cast(percentile.raw_value())), 15) << std::endl; } @@ -190,7 +190,8 @@ DottedStringOutputFormatterImpl::formatProto(const nighthawk::client::Output& ou "{}.microseconds: {}", percentile_prefix, Envoy::Protobuf::util::TimeUtil::DurationToMicroseconds(percentile.duration())); } else { - ss << fmt::format("{}.value: {:.{}f}", percentile_prefix, percentile.raw_value(), 0); + ss << fmt::format("{}.value: {}", percentile_prefix, + static_cast(percentile.raw_value())); } ss << std::endl; }); From 2110bf0e3ab55a81364d296dfd0ab998ed4b00ab Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 16:04:54 +0200 Subject: [PATCH 19/20] Static cast to int64_t Signed-off-by: Otto van der Schaaf --- source/client/output_formatter_impl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/client/output_formatter_impl.cc b/source/client/output_formatter_impl.cc index 726d3a87c..c438179a3 100644 --- a/source/client/output_formatter_impl.cc +++ b/source/client/output_formatter_impl.cc @@ -93,7 +93,7 @@ std::string ConsoleOutputFormatterImpl::formatProto(const nighthawk::client::Out ss << fmt::format(" {:<{}}{:<{}}{:<{}}", p, 12, percentile.count(), 12, percentile.has_duration() ? formatProtoDuration(percentile.duration()) - : fmt::format("{}", static_cast(percentile.raw_value())), + : fmt::format("{}", static_cast(percentile.raw_value())), 15) << std::endl; } @@ -191,7 +191,7 @@ DottedStringOutputFormatterImpl::formatProto(const nighthawk::client::Output& ou Envoy::Protobuf::util::TimeUtil::DurationToMicroseconds(percentile.duration())); } else { ss << fmt::format("{}.value: {}", percentile_prefix, - static_cast(percentile.raw_value())); + static_cast(percentile.raw_value())); } ss << std::endl; }); From 032187c14fb76fa62a175d63aa4cf00c75a50407 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Thu, 9 Apr 2020 18:22:25 +0200 Subject: [PATCH 20/20] Scale back --jobs for ASAN in CI Signed-off-by: Otto van der Schaaf --- ci/do_ci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index c0600588a..2d94cb1ae 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -73,14 +73,14 @@ function do_asan() { echo "bazel ASAN/UBSAN debug build with tests" echo "Building and testing envoy tests..." cd "${SRCDIR}" - [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_TEST_OPTIONS} --local_ram_resources=12288" + [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_TEST_OPTIONS} --jobs=6 --local_ram_resources=12288" # We build this in steps to avoid running out of memory in CI run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/exe/... && \ run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... && \ run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... && \ run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... && \ - run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan --jobs=6 //test/... + run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... } function do_tsan() {