Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions benchmarks/dynamic_test/test_cds_churn_with_traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def _config_generation_single_cluster(temp_dir: str, endpoints: list[utility.Soc
@pytest.mark.parametrize('dynamic_config_generator', [_config_generation_single_cluster])
def test_dynamic_http_single_cluster_traffic(inject_dynamic_envoy_http_proxy_fixture,
proxy_config): # noqa
"""Dynamic HTTP test on a single cluster."""
_run_benchmark(inject_dynamic_envoy_http_proxy_fixture)


Expand Down
1 change: 1 addition & 0 deletions benchmarks/dynamic_test/test_eds_churn_with_traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ def _config_generation_single_cluster(temp_dir: str, endpoints: list[utility.Soc
@pytest.mark.parametrize('dynamic_config_generator', [_config_generation_single_cluster])
def test_dynamic_http_single_cluster_traffic(inject_dynamic_envoy_http_proxy_fixture,
proxy_config): # noqa
"""Dynamic HTTP test on a single cluster."""
_run_benchmark(inject_dynamic_envoy_http_proxy_fixture)
14 changes: 10 additions & 4 deletions benchmarks/test/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,36 +57,42 @@ def _run_benchmark(fixture,
utilities.output_benchmark_results(parsed_json, fixture)


# Test via injected Envoy
@pytest.mark.parametrize('proxy_config', ["nighthawk/benchmarks/configurations/envoy_proxy.yaml"])
@pytest.mark.parametrize('server_config',
["nighthawk/test/integration/configurations/nighthawk_http_origin.yaml"])
def test_http_h1_small_request_small_reply_via(inject_envoy_http_proxy_fixture,
proxy_config): # noqa
"""H1 test with small request and reply via injected Envoy."""
_run_benchmark(inject_envoy_http_proxy_fixture)


# via Envoy, 4 workers. global targets: 1000 qps / 4 connections.
@pytest.mark.parametrize('proxy_config', ["nighthawk/benchmarks/configurations/envoy_proxy.yaml"])
@pytest.mark.parametrize('server_config',
["nighthawk/test/integration/configurations/nighthawk_http_origin.yaml"])
def test_http_h1_small_request_small_reply_via_multiple_workers(inject_envoy_http_proxy_fixture,
proxy_config): # noqa
"""H1 test with small request and reply via multiple workers.

via Envoy, 4 workers. global targets: 1000 qps / 4 connections.
"""
_run_benchmark(inject_envoy_http_proxy_fixture, rps=125, concurrency=4)


# Test the origin directly, using a stock fixture
@pytest.mark.parametrize('server_config',
["nighthawk/test/integration/configurations/nighthawk_http_origin.yaml"])
def test_http_h1_small_request_small_reply_direct(http_test_server_fixture): # noqa
"""H1 test with small request and reply that tests the origin directly, using a stock fixture."""
_run_benchmark(http_test_server_fixture)


# Direct, 4 workers. global targets: 1000 qps / 4 connections.
@pytest.mark.parametrize('server_config',
["nighthawk/test/integration/configurations/nighthawk_http_origin.yaml"])
def test_http_h1_small_request_small_reply_direct_multiple_workers(
http_test_server_fixture): # noqa
"""H1 test with small request and reply that tests the origin directly.

4 workers. global targets: 1000 qps / 4 connections.
"""
_run_benchmark(http_test_server_fixture, rps=125, concurrency=4)


Expand Down
2 changes: 0 additions & 2 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ function do_benchmark_with_own_binaries() {
}

function do_check_format() {
# TODO(1032): Remove this once all files are formatted correctly.
set +eo pipefail
echo "check_format..."
cd "${SRCDIR}"
./tools/check_format.sh check
Expand Down
4 changes: 2 additions & 2 deletions include/nighthawk/adaptive_load/input_variable_setter.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Interfaces for InputVariableSetter plugins and plugin factories.

#pragma once
Comment thread
mum4k marked this conversation as resolved.

// Interfaces for InputVariableSetter plugins and plugin factories.

#include "envoy/common/pure.h"
#include "envoy/config/typed_config.h"

Expand Down
8 changes: 4 additions & 4 deletions include/nighthawk/adaptive_load/metrics_plugin.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Interfaces for MetricsPlugin plugins and plugin factories.

#pragma once
Comment thread
mum4k marked this conversation as resolved.

// Interfaces for MetricsPlugin plugins and plugin factories.

#include "envoy/common/pure.h"
#include "envoy/config/typed_config.h"

Expand All @@ -20,10 +20,10 @@ struct ReportingPeriod {
// start time of the latest (current) iteration of Nighthawk test in the adaptive stage. See
// https://github.com/envoyproxy/nighthawk/blob/main/docs/root/adaptive_load_controller.md#the-adaptive-load-controller
// for more information on adaptive load testing.
google::protobuf::Timestamp start_time;
Envoy::ProtobufWkt::Timestamp start_time;

// The duration of the time where nighthawk is sending the intended load in the adaptive stage.
google::protobuf::Duration duration;
Envoy::ProtobufWkt::Duration duration;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions include/nighthawk/adaptive_load/scoring_function.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Interfaces for ScoringFunction plugins and plugin factories.

#pragma once

// Interfaces for ScoringFunction plugins and plugin factories.

#include "envoy/common/pure.h"
#include "envoy/config/typed_config.h"

Expand Down
4 changes: 2 additions & 2 deletions include/nighthawk/adaptive_load/step_controller.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Interfaces for StepController plugins and plugin factories.

#pragma once

// Interfaces for StepController plugins and plugin factories.

#include "envoy/common/pure.h"
#include "envoy/config/typed_config.h"

Expand Down
4 changes: 3 additions & 1 deletion include/nighthawk/common/operation_callback.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include <functional>

namespace Nighthawk {
Expand All @@ -9,4 +11,4 @@ namespace Nighthawk {
* a success, and is meaningful only when done equals true.
*/
using OperationCallback = std::function<void(bool done, bool success)>;
} // namespace Nighthawk
} // namespace Nighthawk
3 changes: 1 addition & 2 deletions include/nighthawk/common/phase.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#pragma once

#include <memory>
Expand Down Expand Up @@ -48,4 +47,4 @@ class Phase {

using PhasePtr = std::unique_ptr<Phase>;

} // namespace Nighthawk
} // namespace Nighthawk
3 changes: 1 addition & 2 deletions include/nighthawk/common/sequencer.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#pragma once

#include <functional>
Expand Down Expand Up @@ -59,4 +58,4 @@ class Sequencer {

using SequencerPtr = std::unique_ptr<Sequencer>;

} // namespace Nighthawk
} // namespace Nighthawk
3 changes: 1 addition & 2 deletions include/nighthawk/sink/sink.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#pragma once

#include <vector>
Expand Down Expand Up @@ -44,4 +43,4 @@ class Sink {
LoadExecutionResult(absl::string_view execution_id) const PURE;
};

} // namespace Nighthawk
} // namespace Nighthawk
4 changes: 2 additions & 2 deletions source/adaptive_load/adaptive_load_client_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ uint32_t AdaptiveLoadClientMain::Run() {
if (!spec_textproto.ok()) {
throw Nighthawk::NighthawkException("Failed to read spec textproto file \"" + spec_filename_ +
"\": " + std::string(spec_textproto.status().message()));
}
}

nighthawk::adaptive_load::AdaptiveLoadSessionSpec spec;
if (!Envoy::Protobuf::TextFormat::ParseFromString(*spec_textproto, &spec)) {
throw Nighthawk::NighthawkException("Unable to parse file \"" + spec_filename_ +
Expand Down
2 changes: 2 additions & 0 deletions source/adaptive_load/adaptive_load_controller_impl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "envoy/common/time.h"

#include "nighthawk/adaptive_load/adaptive_load_controller.h"
Expand Down
2 changes: 2 additions & 0 deletions source/adaptive_load/config_validator_impl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "nighthawk/adaptive_load/config_validator.h"

namespace Nighthawk {
Expand Down
4 changes: 2 additions & 2 deletions source/adaptive_load/metrics_evaluator_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ absl::StatusOr<ReportingPeriod> GetReportingPeriod(const nighthawk::client::Outp
// Find the reporting_period in which all workers are active and thus sending the intended amount
// of traffic.
ReportingPeriod reporting_period;
google::protobuf::Timestamp max_start_time = output.results(0).execution_start();
google::protobuf::Timestamp min_end_time =
Envoy::ProtobufWkt::Timestamp max_start_time = output.results(0).execution_start();
Envoy::ProtobufWkt::Timestamp min_end_time =
output.results(0).execution_start() + output.results(0).execution_duration();
for (const auto& result : output.results()) {
if (result.execution_start() > max_start_time) {
Expand Down
2 changes: 2 additions & 0 deletions source/adaptive_load/metrics_evaluator_impl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "nighthawk/adaptive_load/metrics_evaluator.h"

namespace Nighthawk {
Expand Down
3 changes: 2 additions & 1 deletion source/adaptive_load/scoring_function_impl.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Implementations of ScoringFunction plugins and corresponding factories.
#pragma once

// Implementations of ScoringFunction plugins and corresponding factories.

#include "envoy/registry/registry.h"

#include "nighthawk/adaptive_load/scoring_function.h"
Expand Down
2 changes: 2 additions & 0 deletions source/adaptive_load/session_spec_proto_helper_impl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "nighthawk/adaptive_load/session_spec_proto_helper.h"

namespace Nighthawk {
Expand Down
3 changes: 2 additions & 1 deletion source/client/flush_worker_impl.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

// Flush worker implementation. Flush worker periodically flushes metrics
// snapshot to all configured stats sinks in Nighthawk.
#pragma once

#include <vector>

Expand Down
2 changes: 2 additions & 0 deletions source/client/process_bootstrap.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include <vector>

#include "nighthawk/client/options.h"
Expand Down
6 changes: 1 addition & 5 deletions source/client/process_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ class NighthawkServerInstance : public Envoy::Server::Instance {
local_info_(local_info), validation_context_(validation_context),
grpc_context_(grpc_context), router_context_(router_context) {}

void run() override {
PANIC("NighthawkServerInstance::run not implemented");
}
void run() override { PANIC("NighthawkServerInstance::run not implemented"); }
Envoy::OptRef<Envoy::Server::Admin> admin() override { return admin_; }
Envoy::Api::Api& api() override { return api_; }
Envoy::Upstream::ClusterManager& clusterManager() override {
Expand Down Expand Up @@ -313,8 +311,6 @@ class NighthawkServerFactoryContext : public Envoy::Server::Configuration::Serve
PANIC("NighthawkServerFactoryContext::initManager not implemented");
};



Envoy::Grpc::Context& grpcContext() override { return server_.grpcContext(); };

Envoy::Router::Context& routerContext() override { return server_.routerContext(); };
Expand Down
2 changes: 2 additions & 0 deletions source/common/nighthawk_service_client_impl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "nighthawk/common/nighthawk_service_client.h"

#include "external/envoy/source/common/common/statusor.h"
Expand Down
3 changes: 1 addition & 2 deletions source/common/phase_impl.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#pragma once

#include "envoy/common/time.h"
Expand Down Expand Up @@ -35,4 +34,4 @@ class PhaseImpl : public Phase, public Envoy::Logger::Loggable<Envoy::Logger::Id
const bool should_measure_latencies_;
};

} // namespace Nighthawk
} // namespace Nighthawk
4 changes: 3 additions & 1 deletion source/common/termination_predicate_impl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include <chrono>

#include "envoy/common/time.h"
Expand Down Expand Up @@ -61,4 +63,4 @@ class StatsCounterAbsoluteThresholdTerminationPredicateImpl : public Termination
const TerminationPredicate::Status termination_status_;
};

} // namespace Nighthawk
} // namespace Nighthawk
3 changes: 2 additions & 1 deletion source/request_source/request_options_list_plugin_impl.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Implementations of RequestSourceConfigFactories that make a OptionsListRequestSource.
#pragma once

// Implementations of RequestSourceConfigFactories that make a OptionsListRequestSource.

#include "envoy/registry/registry.h"

#include "nighthawk/request_source/request_source_plugin_config_factory.h"
Expand Down
31 changes: 20 additions & 11 deletions test/adaptive_load/adaptive_load_client_main_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ TEST(AdaptiveLoadClientMainTest, FailsIfOpeningOutputFileFails) {
NiceMock<Envoy::Filesystem::MockInstance> filesystem;

std::string infile_contents =
Envoy::Filesystem::fileSystemForTest().fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(
std::string("test/adaptive_load/test_data/valid_session_spec.textproto"))).value();
Envoy::Filesystem::fileSystemForTest()
.fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(
std::string("test/adaptive_load/test_data/valid_session_spec.textproto")))
.value();
EXPECT_CALL(filesystem, fileReadToEnd(_)).WillOnce(Return(infile_contents));

auto* mock_file = new NiceMock<Envoy::Filesystem::MockFile>;
Expand Down Expand Up @@ -213,8 +215,10 @@ TEST(AdaptiveLoadClientMainTest, FailsIfWritingOutputFileFails) {
NiceMock<Envoy::Filesystem::MockInstance> filesystem;

std::string infile_contents =
Envoy::Filesystem::fileSystemForTest().fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(
std::string("test/adaptive_load/test_data/valid_session_spec.textproto"))).value();
Envoy::Filesystem::fileSystemForTest()
.fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(
std::string("test/adaptive_load/test_data/valid_session_spec.textproto")))
.value();
EXPECT_CALL(filesystem, fileReadToEnd(_)).WillOnce(Return(infile_contents));

auto* mock_file = new NiceMock<Envoy::Filesystem::MockFile>;
Expand Down Expand Up @@ -246,8 +250,10 @@ TEST(AdaptiveLoadClientMainTest, FailsIfClosingOutputFileFails) {
NiceMock<Envoy::Filesystem::MockInstance> filesystem;

std::string infile_contents =
Envoy::Filesystem::fileSystemForTest().fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(
std::string("test/adaptive_load/test_data/valid_session_spec.textproto"))).value();
Envoy::Filesystem::fileSystemForTest()
.fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(
std::string("test/adaptive_load/test_data/valid_session_spec.textproto")))
.value();
EXPECT_CALL(filesystem, fileReadToEnd(_)).WillOnce(Return(infile_contents));

auto* mock_file = new NiceMock<Envoy::Filesystem::MockFile>;
Expand Down Expand Up @@ -285,8 +291,10 @@ TEST(AdaptiveLoadClientMainTest, WritesOutputProtoToFile) {
NiceMock<Envoy::Filesystem::MockInstance> filesystem;

std::string infile_contents =
Envoy::Filesystem::fileSystemForTest().fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(
std::string("test/adaptive_load/test_data/valid_session_spec.textproto"))).value();
Envoy::Filesystem::fileSystemForTest()
.fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(
std::string("test/adaptive_load/test_data/valid_session_spec.textproto")))
.value();
EXPECT_CALL(filesystem, fileReadToEnd(_)).WillOnce(Return(infile_contents));

std::string actual_outfile_contents;
Expand All @@ -313,9 +321,10 @@ TEST(AdaptiveLoadClientMainTest, WritesOutputProtoToFile) {
AdaptiveLoadClientMain main(5, argv.data(), controller, filesystem);
main.Run();

std::string golden_text =
Envoy::Filesystem::fileSystemForTest().fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(
std::string("test/adaptive_load/test_data/golden_output.textproto"))).value();
std::string golden_text = Envoy::Filesystem::fileSystemForTest()
.fileReadToEnd(Nighthawk::TestEnvironment::runfilesPath(std::string(
"test/adaptive_load/test_data/golden_output.textproto")))
.value();
nighthawk::adaptive_load::AdaptiveLoadSessionOutput golden_proto;
Envoy::Protobuf::TextFormat::ParseFromString(golden_text, &golden_proto);
EXPECT_EQ(actual_outfile_contents, golden_proto.DebugString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#pragma once

#include "envoy/registry/registry.h"
Expand Down
2 changes: 1 addition & 1 deletion test/benchmark_http_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Nighthawk {
namespace {

using ::envoy::config::core::v3::TypedExtensionConfig;
using ::google::protobuf::TextFormat;
using ::Envoy::Protobuf::TextFormat;

// Helper function to get headers in a set that should be verified during the test.
std::string getPathFromRequest(const Envoy::Http::RequestHeaderMap& header) {
Expand Down
2 changes: 1 addition & 1 deletion test/client_worker_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ClientWorkerTest : public Test {
ClientWorkerTest()
: api_(Envoy::Api::createApiForTest()), thread_id_(std::this_thread::get_id()) {
loader_ = Envoy::Runtime::LoaderPtr{new Envoy::Runtime::LoaderImpl(
dispatcher_, tls_, {}, local_info_, store_, rand_, validation_visitor_, *api_)};
dispatcher_, tls_, {}, local_info_, store_, rand_, validation_visitor_, *api_)};
benchmark_client_ = new MockBenchmarkClient();
sequencer_ = new MockSequencer();
request_generator_ = new MockRequestSource();
Expand Down
2 changes: 1 addition & 1 deletion test/flush_worker_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class FlushWorkerTest : public Test {
NiceMock<Envoy::LocalInfo::MockLocalInfo> local_info;
NiceMock<Envoy::ProtobufMessage::MockValidationVisitor> validation_visitor;
loader_ = Envoy::Runtime::LoaderPtr{new Envoy::Runtime::LoaderImpl(
*dispatcher_, tls_, {}, local_info, store_, rand, validation_visitor, api_)};
*dispatcher_, tls_, {}, local_info, store_, rand, validation_visitor, api_)};
sink_ = new StrictMock<Envoy::Stats::MockSink>();
stats_sinks_.emplace_back(sink_);

Expand Down
Loading