Joris Van Remoortere created MESOS-3418:
-------------------------------------------
Summary: Factor out V1 API test helper functions
Key: MESOS-3418
URL: https://issues.apache.org/jira/browse/MESOS-3418
Project: Mesos
Issue Type: Improvement
Reporter: Joris Van Remoortere
We currently have some helper functionality for V1 API tests. This is copied in
a few test files.
Factor this out into a common place once the API is stabilized.
{code}
// Helper class for using EXPECT_CALL since the Mesos scheduler API
// is callback based.
class Callbacks
{
public:
MOCK_METHOD0(connected, void(void));
MOCK_METHOD0(disconnected, void(void));
MOCK_METHOD1(received, void(const std::queue<Event>&));
};
{code}
{code}
// Enqueues all received events into a libprocess queue.
// TODO(jmlvanre): Factor this common code out of tests into V1
// helper.
ACTION_P(Enqueue, queue)
{
std::queue<Event> events = arg0;
while (!events.empty()) {
// Note that we currently drop HEARTBEATs because most of these tests
// are not designed to deal with heartbeats.
// TODO(vinod): Implement DROP_HTTP_CALLS that can filter heartbeats.
if (events.front().type() == Event::HEARTBEAT) {
VLOG(1) << "Ignoring HEARTBEAT event";
} else {
queue->put(events.front());
}
events.pop();
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)