Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 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
78ed3b7
initial commit - fake time source
eric846 Aug 27, 2020
13b5dc2
move from test/adaptive_load to test/common
eric846 Aug 27, 2020
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
30 changes: 30 additions & 0 deletions test/common/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
load(
"@envoy//bazel:envoy_build_system.bzl",
"envoy_cc_test",
"envoy_cc_test_library",
"envoy_package",
)

licenses(["notice"]) # Apache 2

envoy_package()

envoy_cc_test_library(
name = "fake_time_source",
srcs = ["fake_time_source.cc"],
hdrs = ["fake_time_source.h"],
repository = "@envoy",
deps = [
"//source/client:nighthawk_client_lib",
"@com_google_absl//absl/time",
],
)

envoy_cc_test(
name = "fake_time_source_test",
srcs = ["fake_time_source_test.cc"],
repository = "@envoy",
deps = [
":fake_time_source",
],
)
17 changes: 17 additions & 0 deletions test/common/fake_time_source.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "test/common/fake_time_source.h"

namespace Nighthawk {

Envoy::SystemTime FakeIncrementingMonotonicTimeSource::systemTime() {
Envoy::SystemTime epoch;
return epoch;
}

Envoy::MonotonicTime FakeIncrementingMonotonicTimeSource::monotonicTime() {
Envoy::MonotonicTime epoch;
Envoy::MonotonicTime result = epoch + std::chrono::seconds(seconds_since_epoch_);
++seconds_since_epoch_;
return result;
}

} // namespace Nighthawk
29 changes: 29 additions & 0 deletions test/common/fake_time_source.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include "envoy/common/time.h"

namespace Nighthawk {
/**
* Fake time source that ticks 1 second on every query, starting from the Unix epoch. Supports only
* monotonicTime().
*/
class FakeIncrementingMonotonicTimeSource : public Envoy::TimeSource {
public:
/**
* Not supported.
*
* @return Envoy::SystemTime Fixed value of the Unix epoch.
*/
Envoy::SystemTime systemTime() override;
/**
* Ticks forward 1 second on each call.
*
* @return Envoy::MonotonicTime Fake time value.
*/
Envoy::MonotonicTime monotonicTime() override;

private:
int seconds_since_epoch_{0};
};

} // namespace Nighthawk
32 changes: 32 additions & 0 deletions test/common/fake_time_source_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "test/common/fake_time_source.h"

#include "gtest/gtest.h"

namespace Nighthawk {
namespace {

TEST(FakeIncrementingMonotonicTimeSource, SystemTimeAlwaysReturnsEpoch) {
FakeIncrementingMonotonicTimeSource time_source;
Envoy::SystemTime epoch;
EXPECT_EQ(time_source.systemTime(), epoch);
EXPECT_EQ(time_source.systemTime(), epoch);
}

TEST(FakeIncrementingMonotonicTimeSource, MonotonicTimeStartsFromEpoch) {
FakeIncrementingMonotonicTimeSource time_source;
Envoy::MonotonicTime epoch;
Envoy::MonotonicTime time = time_source.monotonicTime();
EXPECT_EQ(std::chrono::duration_cast<std::chrono::seconds>(time - epoch).count(), 0);
}

TEST(FakeIncrementingMonotonicTimeSource, MonotonicTimeIncrementsOneSecondPerCall) {
FakeIncrementingMonotonicTimeSource time_source;
Envoy::MonotonicTime time1 = time_source.monotonicTime();
Envoy::MonotonicTime time2 = time_source.monotonicTime();
Envoy::MonotonicTime time3 = time_source.monotonicTime();
EXPECT_EQ(std::chrono::duration_cast<std::chrono::seconds>(time2 - time1).count(), 1);
EXPECT_EQ(std::chrono::duration_cast<std::chrono::seconds>(time3 - time2).count(), 1);
}

} // namespace
} // namespace Nighthawk