diff options
author | Chenjie Yu <cjyu@google.com> | 2018-12-16 07:37:04 -0800 |
---|---|---|
committer | Chenjie Yu <cjyu@google.com> | 2018-12-21 09:46:09 -0800 |
commit | 0bd73dbaac5fee840f443f287f7bf027c4eb5926 (patch) | |
tree | eda01942b0981ae021e0a23b4a57c4e39025706a /cmds/statsd/tests/shell/ShellSubscriber_test.cpp | |
parent | b7fc056068a8d146c99a8e6932ba7034a7b0bd22 (diff) |
Puller refactor
1) Refactor pullers and add tests.
2) Add timeout to a puller.
mPullTimeoutNs is intrinsic to puller. A pull taking longer than this is
deemed failed and the data discarded.
A metric or StatsPullerManager requesting a pull should monitor the pull
and have deadlineNs. A successful pull may come later than desired due
to statsd processing delays.
3) Add unit tests to puller now that the base puller is more
complicated.
Bug: 118756964
Test: unit test
Change-Id: I0e5d47e2527391f7beef4b2d06bfd5c2f82f1179
Diffstat (limited to 'cmds/statsd/tests/shell/ShellSubscriber_test.cpp')
-rw-r--r-- | cmds/statsd/tests/shell/ShellSubscriber_test.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/cmds/statsd/tests/shell/ShellSubscriber_test.cpp b/cmds/statsd/tests/shell/ShellSubscriber_test.cpp index dd00561854fb..a184f5672d65 100644 --- a/cmds/statsd/tests/shell/ShellSubscriber_test.cpp +++ b/cmds/statsd/tests/shell/ShellSubscriber_test.cpp @@ -189,23 +189,22 @@ TEST(ShellSubscriberTest, testPulledSubscription) { sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>(); sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>(); - EXPECT_CALL(*pullerManager, Pull(10016, _, _)) - .WillRepeatedly( - Invoke([](int tagId, int64_t timeNs, vector<std::shared_ptr<LogEvent>>* data) { - data->clear(); - shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, timeNs); - event->write(kUid1); - event->write(kCpuTime1); - event->init(); - data->push_back(event); - // another event - event = make_shared<LogEvent>(tagId, timeNs); - event->write(kUid2); - event->write(kCpuTime2); - event->init(); - data->push_back(event); - return true; - })); + EXPECT_CALL(*pullerManager, Pull(10016, _)) + .WillRepeatedly(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) { + data->clear(); + shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, 1111L); + event->write(kUid1); + event->write(kCpuTime1); + event->init(); + data->push_back(event); + // another event + event = make_shared<LogEvent>(tagId, 1111L); + event->write(kUid2); + event->write(kCpuTime2); + event->init(); + data->push_back(event); + return true; + })); runShellTest(getPulledConfig(), uidMap, pullerManager, vector<std::shared_ptr<LogEvent>>(), getExpectedShellData()); |