diff --git a/include/nighthawk/adaptive_load/BUILD b/include/nighthawk/adaptive_load/BUILD index 1e0728795..fd658e9f0 100644 --- a/include/nighthawk/adaptive_load/BUILD +++ b/include/nighthawk/adaptive_load/BUILD @@ -35,6 +35,7 @@ envoy_basic_cc_library( "@envoy//include/envoy/common:base_includes", "@envoy//include/envoy/common:time_interface", "@envoy//include/envoy/config:typed_config_interface", + "@envoy//source/common/protobuf:protobuf_with_external_headers", ], ) diff --git a/include/nighthawk/adaptive_load/metrics_evaluator.h b/include/nighthawk/adaptive_load/metrics_evaluator.h index cc969a9dd..c72d03427 100644 --- a/include/nighthawk/adaptive_load/metrics_evaluator.h +++ b/include/nighthawk/adaptive_load/metrics_evaluator.h @@ -1,8 +1,9 @@ +#pragma once + #include "envoy/config/core/v3/base.pb.h" #include "nighthawk/adaptive_load/metrics_plugin.h" -#include "external/envoy/source/common/common/logger.h" #include "external/envoy/source/common/common/statusor.h" #include "external/envoy/source/common/protobuf/protobuf.h" diff --git a/include/nighthawk/adaptive_load/session_spec_proto_helper.h b/include/nighthawk/adaptive_load/session_spec_proto_helper.h index 06e77ded7..a8850c6b9 100644 --- a/include/nighthawk/adaptive_load/session_spec_proto_helper.h +++ b/include/nighthawk/adaptive_load/session_spec_proto_helper.h @@ -25,7 +25,7 @@ class AdaptiveLoadSessionSpecProtoHelper { * @return Adaptive load session spec with default values inserted. */ virtual nighthawk::adaptive_load::AdaptiveLoadSessionSpec - SetSessionSpecDefaults(nighthawk::adaptive_load::AdaptiveLoadSessionSpec spec) PURE; + SetSessionSpecDefaults(nighthawk::adaptive_load::AdaptiveLoadSessionSpec spec) const PURE; /** * Checks whether a session spec is valid: No forbidden fields in Nighthawk traffic spec; no bad @@ -37,7 +37,7 @@ class AdaptiveLoadSessionSpecProtoHelper { * @return Status OK if no problems were found, or InvalidArgument with all errors. */ virtual absl::Status - CheckSessionSpec(const nighthawk::adaptive_load::AdaptiveLoadSessionSpec& spec) PURE; + CheckSessionSpec(const nighthawk::adaptive_load::AdaptiveLoadSessionSpec& spec) const PURE; }; } // namespace Nighthawk \ No newline at end of file diff --git a/include/nighthawk/common/nighthawk_service_client.h b/include/nighthawk/common/nighthawk_service_client.h index 4226837c6..e49ecf654 100644 --- a/include/nighthawk/common/nighthawk_service_client.h +++ b/include/nighthawk/common/nighthawk_service_client.h @@ -10,7 +10,7 @@ namespace Nighthawk { /** - * An interface for interacting with a Nighthawk Service gRPC stub. + * An interface for a stateless helper that interacts with a Nighthawk Service gRPC stub. */ class NighthawkServiceClient { public: @@ -30,7 +30,7 @@ class NighthawkServiceClient { */ virtual absl::StatusOr PerformNighthawkBenchmark( nighthawk::client::NighthawkService::StubInterface* nighthawk_service_stub, - const nighthawk::client::CommandLineOptions& command_line_options) PURE; + const nighthawk::client::CommandLineOptions& command_line_options) const PURE; }; } // namespace Nighthawk diff --git a/source/adaptive_load/session_spec_proto_helper_impl.cc b/source/adaptive_load/session_spec_proto_helper_impl.cc index 3c45d3d86..be8f53bcf 100644 --- a/source/adaptive_load/session_spec_proto_helper_impl.cc +++ b/source/adaptive_load/session_spec_proto_helper_impl.cc @@ -16,7 +16,7 @@ namespace Nighthawk { nighthawk::adaptive_load::AdaptiveLoadSessionSpec AdaptiveLoadSessionSpecProtoHelperImpl::SetSessionSpecDefaults( - nighthawk::adaptive_load::AdaptiveLoadSessionSpec spec) { + nighthawk::adaptive_load::AdaptiveLoadSessionSpec spec) const { if (!spec.nighthawk_traffic_template().has_open_loop()) { spec.mutable_nighthawk_traffic_template()->mutable_open_loop()->set_value(true); } @@ -48,7 +48,7 @@ AdaptiveLoadSessionSpecProtoHelperImpl::SetSessionSpecDefaults( } absl::Status AdaptiveLoadSessionSpecProtoHelperImpl::CheckSessionSpec( - const nighthawk::adaptive_load::AdaptiveLoadSessionSpec& spec) { + const nighthawk::adaptive_load::AdaptiveLoadSessionSpec& spec) const { std::vector errors; if (spec.nighthawk_traffic_template().has_duration()) { errors.emplace_back( diff --git a/source/adaptive_load/session_spec_proto_helper_impl.h b/source/adaptive_load/session_spec_proto_helper_impl.h index d47e3a680..d26dcd586 100644 --- a/source/adaptive_load/session_spec_proto_helper_impl.h +++ b/source/adaptive_load/session_spec_proto_helper_impl.h @@ -5,10 +5,10 @@ namespace Nighthawk { class AdaptiveLoadSessionSpecProtoHelperImpl : public AdaptiveLoadSessionSpecProtoHelper { public: nighthawk::adaptive_load::AdaptiveLoadSessionSpec - SetSessionSpecDefaults(nighthawk::adaptive_load::AdaptiveLoadSessionSpec spec) override; + SetSessionSpecDefaults(nighthawk::adaptive_load::AdaptiveLoadSessionSpec spec) const override; absl::Status - CheckSessionSpec(const nighthawk::adaptive_load::AdaptiveLoadSessionSpec& spec) override; + CheckSessionSpec(const nighthawk::adaptive_load::AdaptiveLoadSessionSpec& spec) const override; }; } // namespace Nighthawk diff --git a/source/common/nighthawk_service_client_impl.cc b/source/common/nighthawk_service_client_impl.cc index db8f1c7dd..10dc82588 100644 --- a/source/common/nighthawk_service_client_impl.cc +++ b/source/common/nighthawk_service_client_impl.cc @@ -7,7 +7,7 @@ namespace Nighthawk { absl::StatusOr NighthawkServiceClientImpl::PerformNighthawkBenchmark( nighthawk::client::NighthawkService::StubInterface* nighthawk_service_stub, - const nighthawk::client::CommandLineOptions& command_line_options) { + const nighthawk::client::CommandLineOptions& command_line_options) const { nighthawk::client::ExecutionRequest request; nighthawk::client::ExecutionResponse response; *request.mutable_start_request()->mutable_options() = command_line_options; diff --git a/source/common/nighthawk_service_client_impl.h b/source/common/nighthawk_service_client_impl.h index 2dd29862e..d8a14eb44 100644 --- a/source/common/nighthawk_service_client_impl.h +++ b/source/common/nighthawk_service_client_impl.h @@ -19,7 +19,7 @@ class NighthawkServiceClientImpl : public NighthawkServiceClient { public: absl::StatusOr PerformNighthawkBenchmark( nighthawk::client::NighthawkService::StubInterface* nighthawk_service_stub, - const nighthawk::client::CommandLineOptions& command_line_options) override; + const nighthawk::client::CommandLineOptions& command_line_options) const override; }; } // namespace Nighthawk