Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
8ea442d
Merge pull request #5 from envoyproxy/master
eric846 Jun 1, 2020
5ac755a
Merge pull request #6 from envoyproxy/master
eric846 Jun 28, 2020
b8c25a5
Merge pull request #7 from envoyproxy/master
eric846 Jul 7, 2020
1c19c68
initial commit
eric846 Jul 9, 2020
7050686
fix comments
eric846 Jul 9, 2020
0776563
fix format
eric846 Jul 9, 2020
16fd8f6
rename adaptive_rps to adaptive_load
eric846 Jul 10, 2020
c383010
add field_selector in example
eric846 Jul 10, 2020
6e1a483
fix example comment
eric846 Jul 10, 2020
4ef1140
fix format
eric846 Jul 10, 2020
4111bf4
add support for fault injection headers
eric846 Jul 10, 2020
871a959
replace linear and binary search with exponential search
eric846 Jul 10, 2020
1fd77c1
add InputVariableSetter mechanism
eric846 Jul 11, 2020
edc36b2
add input variable setter to build file
eric846 Jul 11, 2020
4d0364e
fix syntax errors
eric846 Jul 11, 2020
aed6d94
rename samples/adaptive_rps
eric846 Jul 11, 2020
d9ae87d
improve comments, change step controller initial value from int64 to …
eric846 Jul 12, 2020
a05a6f5
add proto validation rules, fix comments, make rps the default input_…
eric846 Jul 13, 2020
8cd4d21
fix comment wording
eric846 Jul 13, 2020
d814a96
simplify protos, add defaults, specify required or optional
eric846 Jul 14, 2020
5f5a885
add missing newline
eric846 Jul 14, 2020
7e20a78
Kick CI
eric846 Jul 14, 2020
9048267
simplify protos
eric846 Jul 15, 2020
306c0ec
fix format
eric846 Jul 15, 2020
d33f543
fix some optional field comments and rules
eric846 Jul 15, 2020
442cca9
Merge pull request #10 from envoyproxy/master
eric846 Jul 16, 2020
677b783
add Nighthawk status field in BenchmarkResult as nested nighthawk.cli…
eric846 Jul 19, 2020
cefb366
switch to standard Envoy plugin config proto, add prefix to internal …
eric846 Jul 22, 2020
f3684df
Merge remote-tracking branch 'upstream/master' into adaptive-rps-protos2
eric846 Jul 22, 2020
5463051
create headers
eric846 Jul 22, 2020
46e0e25
fix format
eric846 Jul 22, 2020
f634642
use docstring format
eric846 Jul 22, 2020
3c39faa
fix typos in comments
eric846 Jul 23, 2020
b9c8f2b
split build target, get rid of ostream, change InputValueSetter to us…
eric846 Jul 24, 2020
5fc4db4
remove nested namespace, remove redundant _include in target names
eric846 Jul 26, 2020
64e7852
merge from upstream
eric846 Jul 29, 2020
12807f1
Merge remote-tracking branch 'upstream/master' into adaptive-rps-headers
eric846 Jul 29, 2020
e8e960f
merge from upstream
eric846 Aug 27, 2020
6306b4e
Merge remote-tracking branch 'upstream/master' into master2
eric846 Aug 27, 2020
1ece783
Merge remote-tracking branch 'upstream/master' into master2
eric846 Aug 28, 2020
70705e9
Merge remote-tracking branch 'upstream/master' into master2
eric846 Aug 31, 2020
e576bc1
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 1, 2020
1fca528
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 3, 2020
ed32856
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 3, 2020
eecf00d
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 8, 2020
13179fb
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 10, 2020
3eb89e6
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 11, 2020
fae60ad
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 12, 2020
9fec200
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 14, 2020
9d1cf53
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 15, 2020
cfad844
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 19, 2020
bdde910
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 22, 2020
8100376
Merge remote-tracking branch 'upstream/master' into master2
eric846 Sep 28, 2020
694fda6
Merge remote-tracking branch 'upstream/master' into master2
eric846 Dec 29, 2020
ae54ef4
initial commit, adding error 13 detail
eric846 Dec 30, 2020
ac99902
fix typo
eric846 Dec 30, 2020
f665957
fix service test, fix format
eric846 Dec 30, 2020
bbb5d63
fix format
eric846 Dec 30, 2020
0ea8496
simplify if block
eric846 Jan 4, 2021
84d3d1d
mention OK status when cancelled
eric846 Jan 4, 2021
ba417eb
mention OK status when cancelled in remote_process_impl
eric846 Jan 4, 2021
35e5b86
update process.h to comment that OK status includes cancellation
eric846 Jan 4, 2021
b5279a8
return CancelledError when execution cancelled; fix unit test that ex…
eric846 Jan 5, 2021
aeeaecc
Merge remote-tracking branch 'upstream/master' into master2
eric846 Jan 14, 2021
9ce2017
Merge branch 'master2' into error13
eric846 Jan 14, 2021
10f4a69
change TimestampToMicroseconds back to TimestampToNanoseconds to get …
eric846 Jan 14, 2021
1df6137
Merge remote-tracking branch 'upstream/main'
eric846 Jan 21, 2021
45e9269
Merge branch 'main' into error13
eric846 Jan 21, 2021
2b9e1e8
Merge remote-tracking branch 'upstream/main'
eric846 Jan 26, 2021
be7f23c
Merge branch 'main' into error13
eric846 Jan 26, 2021
a6da150
Merge remote-tracking branch 'upstream/main'
eric846 Feb 3, 2021
485d01d
Merge branch 'main' into error13
eric846 Feb 3, 2021
4b8ba84
Merge remote-tracking branch 'upstream/main'
eric846 Feb 4, 2021
ff05962
Merge branch 'main' into error13
eric846 Feb 4, 2021
eaa20de
Merge remote-tracking branch 'upstream/main'
eric846 Feb 11, 2021
1873c7b
Merge branch 'main' into error13
eric846 Feb 11, 2021
cbabf1b
add more troubleshooting tips, especially --address-family v4/v6
eric846 Feb 11, 2021
aedd520
Merge remote-tracking branch 'upstream/main'
eric846 Feb 11, 2021
50d3e09
Merge branch 'main' into error13
eric846 Feb 11, 2021
71b0433
add more localhost advice
eric846 Feb 11, 2021
4ec202a
Merge remote-tracking branch 'upstream/main'
eric846 Feb 23, 2021
acd0302
Merge branch 'main' into error13
eric846 Feb 23, 2021
6a7aeec
add default failure predicate for stream resets
eric846 Feb 23, 2021
842a721
stream_resets plural
eric846 Feb 23, 2021
f42c374
Merge remote-tracking branch 'upstream/main'
eric846 Feb 25, 2021
1f9dbf6
Merge branch 'main' into error13
eric846 Feb 25, 2021
be5c0fa
Merge remote-tracking branch 'upstream/main'
eric846 Mar 8, 2021
7da182a
Merge remote-tracking branch 'upstream/main'
eric846 Mar 10, 2021
d3e5545
Merge remote-tracking branch 'upstream/main'
eric846 Mar 11, 2021
32307e1
Merge branch 'main' into error13
eric846 Mar 11, 2021
2f44065
Merge remote-tracking branch 'upstream/main'
eric846 Mar 15, 2021
2cd7d47
Merge branch 'main' into error13
eric846 Mar 15, 2021
190a691
Merge remote-tracking branch 'upstream/main'
eric846 Mar 17, 2021
33d1913
Merge branch 'main' into error13
eric846 Mar 17, 2021
1035b2d
fix integration test failures: avoid random failure predicate mismatc…
eric846 Mar 18, 2021
74de764
Merge remote-tracking branch 'upstream/main'
eric846 Mar 18, 2021
a27b30a
return ok status when execution was cancelled
eric846 Mar 18, 2021
7bda479
update process_test to anticipate ok status when cancelling
eric846 Mar 18, 2021
c2baebd
Merge remote-tracking branch 'upstream/main'
eric846 Mar 18, 2021
1d00bbb
Merge branch 'main' into error13
eric846 Mar 18, 2021
da83218
Merge remote-tracking branch 'upstream/main'
eric846 Mar 22, 2021
f954fca
merge from upstream`
eric846 Mar 22, 2021
e78adac
Merge remote-tracking branch 'upstream/main'
eric846 Mar 25, 2021
aeb9882
merge from upstream
eric846 Mar 25, 2021
f79c078
Merge remote-tracking branch 'upstream/main'
eric846 Mar 29, 2021
e8f074c
Merge branch 'main' into error13
eric846 Mar 29, 2021
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
6 changes: 4 additions & 2 deletions include/nighthawk/client/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "nighthawk/client/output_collector.h"

#include "absl/status/status.h"

namespace Nighthawk {
namespace Client {

Expand All @@ -15,9 +17,9 @@ class Process {

/**
* @param collector used to transform output into the desired format.
* @return bool true iff execution was successfull.
* @return OK if execution succeeded or was cancelled, otherwise error details.
*/
virtual bool run(OutputCollector& collector) PURE;
virtual absl::Status run(OutputCollector& collector) PURE;

/**
* Shuts down the worker. Mandatory call before destructing.
Expand Down
12 changes: 6 additions & 6 deletions source/client/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bool Main::run() {
}
OutputFormatterFactoryImpl output_formatter_factory;
OutputCollectorImpl output_collector(time_system, *options_);
bool result;
absl::Status result;
{
auto signal_handler =
std::make_unique<SignalHandler>([&process]() { process->requestExecutionCancellation(); });
Expand All @@ -92,12 +92,12 @@ bool Main::run() {
std::cout << *formatted_proto;
}
process->shutdown();
if (!result) {
ENVOY_LOG(error, "An error ocurred.");
} else {
ENVOY_LOG(info, "Done.");
if (!result.ok()) {
ENVOY_LOG(error, "An error occurred: {}.", result.message());
return false;
}
return result;
ENVOY_LOG(info, "Done.");
return true;
}

} // namespace Client
Expand Down
5 changes: 3 additions & 2 deletions source/client/options_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -667,11 +667,12 @@ OptionsImpl::OptionsImpl(const nighthawk::client::CommandLineOptions& options) {

void OptionsImpl::setNonTrivialDefaults() {
concurrency_ = "1";
// By default, we don't tolerate error status codes and connection failures, and will report
// upon observing those.
// By default, we don't tolerate error status codes, connection failures, or stream resets which
// could indicate a protocol mismatch, and will report upon observing those.
failure_predicates_["benchmark.http_4xx"] = 0;
failure_predicates_["benchmark.http_5xx"] = 0;
failure_predicates_["benchmark.pool_connection_failure"] = 0;
failure_predicates_["benchmark.stream_resets"] = 0;
// Also, fail fast when a remote request source is specified that we can't connect to or otherwise
// fails.
failure_predicates_["requestsource.upstream_rq_5xx"] = 0;
Expand Down
44 changes: 32 additions & 12 deletions source/client/process_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "external/envoy/source/common/thread_local/thread_local_impl.h"
#include "external/envoy/source/server/server.h"

#include "absl/status/status.h"
#include "absl/strings/str_replace.h"
#include "absl/types/optional.h"

Expand Down Expand Up @@ -473,18 +474,19 @@ void ProcessImpl::setupStatsSinks(const envoy::config::bootstrap::v3::Bootstrap&
}
}

bool ProcessImpl::runInternal(OutputCollector& collector, const std::vector<UriPtr>& uris,
const UriPtr& request_source_uri, const UriPtr& tracing_uri,
const absl::optional<Envoy::SystemTime>& scheduled_start) {
absl::Status ProcessImpl::runInternal(OutputCollector& collector, const std::vector<UriPtr>& uris,
const UriPtr& request_source_uri, const UriPtr& tracing_uri,
const absl::optional<Envoy::SystemTime>& scheduled_start) {
const Envoy::SystemTime now = time_system_.systemTime();
if (scheduled_start.value_or(now) < now) {
ENVOY_LOG(error, "Scheduled execution date already transpired.");
return false;
return absl::InternalError("Scheduled execution date already transpired.");
}
{
auto guard = std::make_unique<Envoy::Thread::LockGuard>(workers_lock_);
if (cancelled_) {
return true;
ENVOY_LOG(info, "Execution was cancelled before it started.");
return absl::OkStatus();
}
int number_of_workers = determineConcurrency();
shutdown_ = false;
Expand Down Expand Up @@ -598,17 +600,32 @@ bool ProcessImpl::runInternal(OutputCollector& collector, const std::vector<UriP
StatisticFactoryImpl statistic_factory(options_);
collector.addResult("global", mergeWorkerStatistics(workers_), counters,
total_execution_duration / workers_.size(), first_acquisition_time);
return counters.find("sequencer.failed_terminations") == counters.end();
if (cancelled_) {
ENVOY_LOG(info, "Execution was cancelled.");
return absl::OkStatus();
}
if (counters.find("sequencer.failed_terminations") != counters.end()) {
return absl::InternalError(
"Terminated early because of a failure predicate. Check the output for problematic counter "
"values. The default Nighthawk failure predicates report failure if (1) Nighthawk could "
"not connect to the target (see 'benchmark.pool_connection_failure' counter; check the "
"address and port number, and try explicitly setting --address-family v4 or v6, especially "
"when using DNS; instead of localhost try 127.0.0.1 or ::1 explicitly), (2) the protocol "
"was not supported by the target (see 'benchmark.stream_resets' counter; check http/https "
"in the URI, --h2), (3) the target returned a 4xx or 5xx HTTP response code (see "
"'benchmark.http_#xx' counters; check the URI path and the server config), or (4) a custom "
"gRPC RequestSource failed. --failure-predicate can be used to relax expectations.");
}
return absl::OkStatus();
}

bool ProcessImpl::run(OutputCollector& collector) {
absl::Status ProcessImpl::run(OutputCollector& collector) {
std::vector<UriPtr> uris;
UriPtr request_source_uri;
UriPtr tracing_uri;

try {
// TODO(oschaaf): See if we can rid of resolving here.
// We now only do it to validate.
// Resolving URIs validates the syntax and also detects DNS errors.
if (options_.uri().has_value()) {
uris.push_back(std::make_unique<UriImpl>(options_.uri().value()));
} else {
Expand All @@ -632,16 +649,19 @@ bool ProcessImpl::run(OutputCollector& collector) {
tracing_uri->resolve(*dispatcher_,
Utility::translateFamilyOptionString(options_.addressFamily()));
}
} catch (const UriException&) {
return false;
} catch (const UriException& ex) {
return absl::InvalidArgumentError(
absl::StrCat("URI exception (for example, malformed URI syntax, bad "
"MultiTarget path, unresolvable host DNS): ",
ex.what()));
}

try {
return runInternal(collector, uris, request_source_uri, tracing_uri,
options_.scheduled_start());
} catch (Envoy::EnvoyException& ex) {
ENVOY_LOG(error, "Fatal exception: {}", ex.what());
throw;
return absl::InternalError(absl::StrCat("Fatal exception: ", ex.what()));
}
}

Expand Down
10 changes: 5 additions & 5 deletions source/client/process_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class ProcessImpl : public Process, public Envoy::Logger::Loggable<Envoy::Logger
*
* @param collector output collector implementation which will collect and hold the native output
* format.
* @return true iff execution should be considered successful.
* @return OK if execution was successful, otherwise error details.
*/
bool run(OutputCollector& collector) override;
absl::Status run(OutputCollector& collector) override;

/**
* Should be called before destruction to cleanly shut down.
Expand Down Expand Up @@ -124,9 +124,9 @@ class ProcessImpl : public Process, public Envoy::Logger::Loggable<Envoy::Logger
*/
void setupStatsSinks(const envoy::config::bootstrap::v3::Bootstrap& bootstrap,
std::list<std::unique_ptr<Envoy::Stats::Sink>>& stats_sinks);
bool runInternal(OutputCollector& collector, const std::vector<UriPtr>& uris,
const UriPtr& request_source_uri, const UriPtr& tracing_uri,
const absl::optional<Envoy::SystemTime>& schedule);
absl::Status runInternal(OutputCollector& collector, const std::vector<UriPtr>& uris,
const UriPtr& request_source_uri, const UriPtr& tracing_uri,
const absl::optional<Envoy::SystemTime>& schedule);

/**
* Compute the offset at which execution should start. We adhere to the scheduled start passed in
Expand Down
9 changes: 6 additions & 3 deletions source/client/remote_process_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "client/options_impl.h"

#include "absl/status/status.h"

namespace Nighthawk {
namespace Client {

Expand All @@ -22,7 +24,7 @@ RemoteProcessImpl::RemoteProcessImpl(const Options& options,
: options_(options), service_client_(std::make_unique<NighthawkServiceClientImpl>()),
stub_(stub) {}

bool RemoteProcessImpl::run(OutputCollector& collector) {
absl::Status RemoteProcessImpl::run(OutputCollector& collector) {
Nighthawk::Client::CommandLineOptionsPtr options = options_.toCommandLineOptions();
// We don't forward the option that requests remote execution. Today,
// nighthawk_service will ignore the option, but if someone ever changes that this
Expand All @@ -33,10 +35,11 @@ bool RemoteProcessImpl::run(OutputCollector& collector) {
service_client_->PerformNighthawkBenchmark(&stub_, *options);
if (result.ok()) {
collector.setOutput(result.value().output());
return true;
return absl::OkStatus();
}
ENVOY_LOG(error, "Remote execution failure: {}", result.status().message());
return false;
return absl::Status(static_cast<absl::StatusCode>(result.status().code()),
absl::StrCat("Remote execution failure: ", result.status().message()));
}

bool RemoteProcessImpl::requestExecutionCancellation() {
Expand Down
5 changes: 2 additions & 3 deletions source/client/remote_process_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ class RemoteProcessImpl : public Process, public Envoy::Logger::Loggable<Envoy::
RemoteProcessImpl(const Options& options, nighthawk::client::NighthawkService::Stub& stub);
/**
* @param collector Collects the output from the remote nighthawk service.
* @return true iff the remote execution should be considered successful. Unsuccessful execution
* will log available error details.
* @return OK if execution was successful, otherwise error details.
*/
bool run(OutputCollector& collector) override;
absl::Status run(OutputCollector& collector) override;
/**
* Shuts down the service, a no-op in this implementation.
*/
Expand Down
10 changes: 4 additions & 6 deletions source/client/service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ void ServiceImpl::handleExecutionRequest(const nighthawk::client::ExecutionReque

ProcessImpl process(*options, time_system_, process_wide_);
OutputCollectorImpl output_collector(time_system_, *options);
const bool ok = process.run(output_collector);
if (!ok) {
response.mutable_error_detail()->set_code(grpc::StatusCode::INTERNAL);
// TODO(https://github.com/envoyproxy/nighthawk/issues/181): wire through error descriptions, so
// we can do better here.
response.mutable_error_detail()->set_message("Unknown failure");
const absl::Status run_status = process.run(output_collector);
if (!run_status.ok()) {
response.mutable_error_detail()->set_code(static_cast<int>(run_status.code()));
response.mutable_error_detail()->set_message(std::string(run_status.message()));
}
*(response.mutable_output()) = output_collector.toProto();
process.shutdown();
Expand Down
1 change: 1 addition & 0 deletions test/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ py_library(
"//:nighthawk_output_transform",
"//:nighthawk_service",
"//:nighthawk_test_server",
"//test/request_source:testdata",
"@envoy//test/config/integration/certs",
],
deps = [
Expand Down
3 changes: 3 additions & 0 deletions test/options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ TEST_P(RequestSourcePluginTestFixture, CreatesOptionsImplWithRequestSourceConfig
// comparison below.
EXPECT_EQ(1, command->mutable_failure_predicates()->erase("benchmark.http_4xx"));
EXPECT_EQ(1, command->mutable_failure_predicates()->erase("benchmark.http_5xx"));
EXPECT_EQ(1, command->mutable_failure_predicates()->erase("benchmark.stream_resets"));
EXPECT_EQ(1, command->mutable_failure_predicates()->erase("requestsource.upstream_rq_5xx"));

// TODO(#433)
Expand Down Expand Up @@ -438,6 +439,7 @@ TEST_F(OptionsImplTest, TlsContext) {
// comparison below.
EXPECT_EQ(1, cmd->mutable_failure_predicates()->erase("benchmark.http_4xx"));
EXPECT_EQ(1, cmd->mutable_failure_predicates()->erase("benchmark.http_5xx"));
EXPECT_EQ(1, cmd->mutable_failure_predicates()->erase("benchmark.stream_resets"));
EXPECT_EQ(1, cmd->mutable_failure_predicates()->erase("requestsource.upstream_rq_5xx"));
// TODO(#433)
OptionsImpl options_from_proto(*cmd);
Expand Down Expand Up @@ -500,6 +502,7 @@ TEST_F(OptionsImplTest, MultiTarget) {
// textual comparison below.
EXPECT_EQ(1, cmd->mutable_failure_predicates()->erase("benchmark.http_4xx"));
EXPECT_EQ(1, cmd->mutable_failure_predicates()->erase("benchmark.http_5xx"));
EXPECT_EQ(1, cmd->mutable_failure_predicates()->erase("benchmark.stream_resets"));
EXPECT_EQ(1, cmd->mutable_failure_predicates()->erase("requestsource.upstream_rq_5xx"));
// TODO(#433)
OptionsImpl options_from_proto(*cmd);
Expand Down
27 changes: 12 additions & 15 deletions test/process_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ class FakeStatsSinkFactory : public NighthawkStatsSinkFactory {
// expect failure.
class ProcessTest : public TestWithParam<Envoy::Network::Address::IpVersion> {
public:
enum class RunExpectation { EXPECT_SUCCESS, EXPECT_FAILURE };

ProcessTest()
: loopback_address_(Envoy::Network::Test::getLoopbackAddressUrlString(GetParam())),
options_(TestUtility::createOptionsImpl(
fmt::format("foo --duration 1 -v error --rps 10 https://{}/", loopback_address_))){};

void runProcess(RunExpectation expectation, bool do_cancel = false,
void runProcess(absl::StatusCode expected_status_code, bool do_cancel = false,
bool terminate_right_away = false) {
ProcessPtr process = std::make_unique<ProcessImpl>(*options_, time_system_);
OutputCollectorImpl collector(time_system_, *options_);
Expand All @@ -91,9 +89,8 @@ class ProcessTest : public TestWithParam<Envoy::Network::Address::IpVersion> {
cancel_thread.join();
}
}
const auto result =
process->run(collector) ? RunExpectation::EXPECT_SUCCESS : RunExpectation::EXPECT_FAILURE;
EXPECT_EQ(result, expectation);
absl::Status run_status = process->run(collector);
EXPECT_EQ(run_status.code(), expected_status_code);
if (do_cancel) {
if (cancel_thread.joinable()) {
cancel_thread.join();
Expand Down Expand Up @@ -126,17 +123,17 @@ INSTANTIATE_TEST_SUITE_P(IpVersions, ProcessTest,
Envoy::TestUtility::ipTestParamsToString);

TEST_P(ProcessTest, TwoProcessInSequence) {
runProcess(RunExpectation::EXPECT_FAILURE);
runProcess(absl::StatusCode::kInternal);
options_ = TestUtility::createOptionsImpl(
fmt::format("foo --h2 --duration 1 --rps 10 https://{}/", loopback_address_));
runProcess(RunExpectation::EXPECT_FAILURE);
runProcess(absl::StatusCode::kInternal);
}

// TODO(oschaaf): move to python int. tests once it adds to coverage.
TEST_P(ProcessTest, BadTracerSpec) {
options_ = TestUtility::createOptionsImpl(
fmt::format("foo --trace foo://localhost:79/api/v1/spans https://{}/", loopback_address_));
runProcess(RunExpectation::EXPECT_FAILURE);
runProcess(absl::StatusCode::kInvalidArgument);
}

TEST_P(ProcessTest, CancelDuringLoadTest) {
Expand All @@ -146,14 +143,14 @@ TEST_P(ProcessTest, CancelDuringLoadTest) {
options_ = TestUtility::createOptionsImpl(
fmt::format("foo --duration 300 --failure-predicate foo:0 --concurrency 2 https://{}/",
loopback_address_));
runProcess(RunExpectation::EXPECT_SUCCESS, true);
runProcess(absl::StatusCode::kOk, /*do_cancel=*/true);
}

TEST_P(ProcessTest, CancelExecutionBeforeBeginLoadTest) {
options_ = TestUtility::createOptionsImpl(
fmt::format("foo --duration 300 --failure-predicate foo:0 --concurrency 2 https://{}/",
loopback_address_));
runProcess(RunExpectation::EXPECT_SUCCESS, true, true);
runProcess(absl::StatusCode::kOk, /*do_cancel=*/true, /*terminate_right_away=*/true);
}

TEST_P(ProcessTest, RunProcessWithStatsSinkConfigured) {
Expand All @@ -164,7 +161,7 @@ TEST_P(ProcessTest, RunProcessWithStatsSinkConfigured) {
"--stats-sinks {} https://{}/",
kSinkName, loopback_address_));
numFlushes = 0;
runProcess(RunExpectation::EXPECT_FAILURE);
runProcess(absl::StatusCode::kInternal);
EXPECT_GT(numFlushes, 0);
}

Expand All @@ -176,7 +173,7 @@ TEST_P(ProcessTest, NoFlushWhenCancelExecutionBeforeLoadTestBegin) {
"2 --stats-flush-interval 1 --stats-sinks {} https://{}/",
kSinkName, loopback_address_));
numFlushes = 0;
runProcess(RunExpectation::EXPECT_SUCCESS, true, true);
runProcess(absl::StatusCode::kOk, /*do_cancel=*/true, /*terminate_right_away=*/true);
EXPECT_EQ(numFlushes, 0);
}

Expand All @@ -196,9 +193,9 @@ class ProcessTestWithSimTime : public Envoy::Event::TestUsingSimulatedTime,
auto run_thread = std::thread([this, &verify_callback] {
ProcessPtr process = std::make_unique<ProcessImpl>(*options_, simTime());
OutputCollectorImpl collector(simTime(), *options_);
const bool result = process->run(collector);
const absl::Status result = process->run(collector);
process->shutdown();
verify_callback(result, collector.toProto());
verify_callback(result.ok(), collector.toProto());
});

// We introduce real-world sleeps to give the executing ProcessImpl
Expand Down
Loading