Skip to content

Commit e28e185

Browse files
committed
Clean up client_worker_test.cc
Signed-off-by: Otto van der Schaaf <[email protected]>
1 parent bf0f4ac commit e28e185

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ envoy_cc_test(
5959
"@envoy//test/mocks/local_info:local_info_mocks",
6060
"@envoy//test/mocks/protobuf:protobuf_mocks",
6161
"@envoy//test/mocks/thread_local:thread_local_mocks",
62+
"@envoy//test/test_common:simulated_time_system_lib",
6263
],
6364
)
6465

test/client_worker_test.cc

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "external/envoy/test/mocks/local_info/mocks.h"
1010
#include "external/envoy/test/mocks/protobuf/mocks.h"
1111
#include "external/envoy/test/mocks/thread_local/mocks.h"
12+
#include "external/envoy/test/test_common/simulated_time_system.h"
1213

1314
#include "common/statistic_impl.h"
1415

@@ -74,11 +75,6 @@ class ClientWorkerTest : public Test {
7475
TerminationPredicatePtr createMockTerminationPredicate() {
7576
auto predicate = std::make_unique<NiceMock<MockTerminationPredicate>>();
7677
ON_CALL(*predicate, appendToChain(_)).WillByDefault(ReturnRef(*predicate));
77-
EXPECT_CALL(*predicate, evaluateChain())
78-
.Times(AtLeast(0))
79-
.WillOnce(Return(TerminationPredicate::Status::PROCEED))
80-
.WillOnce(Return(TerminationPredicate::Status::TERMINATE));
81-
8278
return predicate;
8379
}
8480

@@ -91,7 +87,7 @@ class ClientWorkerTest : public Test {
9187
MockRequestSourceFactory request_generator_factory_;
9288
Envoy::Stats::IsolatedStoreImpl store_;
9389
NiceMock<Envoy::ThreadLocal::MockInstance> tls_;
94-
Envoy::Event::TestRealTimeSystem time_system_;
90+
Envoy::Event::SimulatedTimeSystem time_system_;
9591
MockBenchmarkClient* benchmark_client_;
9692
MockSequencer* sequencer_;
9793
MockRequestSource* request_generator_;
@@ -112,8 +108,7 @@ TEST_F(ClientWorkerTest, BasicTest) {
112108
InSequence dummy;
113109
EXPECT_CALL(*benchmark_client_, setShouldMeasureLatencies(false)).Times(1);
114110
EXPECT_CALL(*benchmark_client_, tryStartRequest(_))
115-
.Times(1)
116-
.WillRepeatedly(Invoke(this, &ClientWorkerTest::CheckThreadChanged));
111+
.WillOnce(Invoke(this, &ClientWorkerTest::CheckThreadChanged));
117112
EXPECT_CALL(*benchmark_client_, setShouldMeasureLatencies(true)).Times(1);
118113
EXPECT_CALL(*sequencer_, start).Times(1);
119114
EXPECT_CALL(*sequencer_, waitForCompletion).Times(1);
@@ -124,8 +119,7 @@ TEST_F(ClientWorkerTest, BasicTest) {
124119
auto worker = std::make_unique<ClientWorkerImpl>(
125120
*api_, tls_, cluster_manager_ptr_, benchmark_client_factory_, termination_predicate_factory_,
126121
sequencer_factory_, request_generator_factory_, store_, worker_number,
127-
time_system_.monotonicTime() + 10ms, http_tracer_,
128-
ClientWorkerImpl::HardCodedWarmupStyle::ON);
122+
time_system_.monotonicTime(), http_tracer_, ClientWorkerImpl::HardCodedWarmupStyle::ON);
129123

130124
worker->start();
131125
worker->waitForCompletion();

0 commit comments

Comments
 (0)