You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Till Toenshoff (JIRA)" <ji...@apache.org> on 2015/11/10 16:12:11 UTC

[jira] [Updated] (MESOS-3418) Factor out V1 API test helper functions

     [ https://issues.apache.org/jira/browse/MESOS-3418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Till Toenshoff updated MESOS-3418:
----------------------------------
    Target Version/s: 0.27.0  (was: 0.26.0)

> 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
>            Assignee: Guangya Liu
>              Labels: beginner, mesosphere, newbie, v1_api
>
> 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}
> We can also update the helpers in {{/tests/mesos.hpp}} to support the V1 API.  This would let us get ride of lines like:
> {code}
> v1::TaskInfo taskInfo = evolve(createTask(devolve(offer), "", DEFAULT_EXECUTOR_ID));
> {code}
> In favor of:
> {code}
> v1::TaskInfo taskInfo = createTask(offer, "", DEFAULT_EXECUTOR_ID);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)