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

Alexander Rukletsov updated MESOS-5886:
---------------------------------------
    Summary: FUTURE_DISPATCH may react on irrelevant dispatch.  (was: 
FUTURE_DISPATCH may react on wrong dispatch.)

> FUTURE_DISPATCH may react on irrelevant dispatch.
> -------------------------------------------------
>
>                 Key: MESOS-5886
>                 URL: https://issues.apache.org/jira/browse/MESOS-5886
>             Project: Mesos
>          Issue Type: Bug
>            Reporter: Alexander Rukletsov
>              Labels: mesosphere, tech-debt, tech-debt-test
>
> [{{FUTURE_DISPATCH}}|https://github.com/apache/mesos/blob/e8ebbe5fe4189ef7ab046da2276a6abee41deeb2/3rdparty/libprocess/include/process/gmock.hpp#L50]
>  uses 
> [{{DispatchMatcher}}|https://github.com/apache/mesos/blob/e8ebbe5fe4189ef7ab046da2276a6abee41deeb2/3rdparty/libprocess/include/process/gmock.hpp#L350]
>  to figure out whether a processed {{DispatchEvent}} is the same the user is 
> waiting for. However, comparing {{std::type_info}} of function pointers is 
> not enough: different class methods with same signatures will be matched. 
> Here is the test that proves this:
> {noformat}
> class DispatchProcess : public Process<DispatchProcess>
> {
> public:
>   MOCK_METHOD0(func0, void());
>   MOCK_METHOD1(func1, bool(bool));
>   MOCK_METHOD1(func1_same_but_different, bool(bool));
>   MOCK_METHOD1(func2, Future<bool>(bool));
>   MOCK_METHOD1(func3, int(int));
>   MOCK_METHOD2(func4, Future<bool>(bool, int));
> };
> {noformat}
> {noformat}
> TEST(ProcessTest, DispatchMatch)
> {
>   DispatchProcess process;
>   PID<DispatchProcess> pid = spawn(&process);
>   Future<Nothing> future = FUTURE_DISPATCH(
>       pid,
>       &DispatchProcess::func1_same_but_different);
>   EXPECT_CALL(process, func1(_))
>     .WillOnce(ReturnArg<0>());
>   dispatch(pid, &DispatchProcess::func1, true);
>   AWAIT_READY(future);
>   terminate(pid);
>   wait(pid);
> }
> {noformat}
> The test passes:
> {noformat}
> [ RUN      ] ProcessTest.DispatchMatch
> [       OK ] ProcessTest.DispatchMatch (1 ms)
> {noformat}
> This change was introduced in https://reviews.apache.org/r/28052/.



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

Reply via email to