You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Anand Mazumdar <ma...@gmail.com> on 2015/10/16 04:49:31 UTC

Review Request 39372: Introduced a callback interface for testing the Scheduler Library

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39372/
-----------------------------------------------------------

Review request for mesos, Ben Mahler, Isabel Jimenez, and Vinod Kone.


Bugs: MESOS-3339
    https://issues.apache.org/jira/browse/MESOS-3339


Repository: mesos


Description
-------

Instead of introducing a `DROP_HTTP_EVENT` filtering abstraction, made the existing interface callback based that allows to use the already existing testing semantics. Also, the new interface allows us to use a generic interface across scheduler library versions.

This gets rid of the following hack:
```
// Enqueues all received events into a libprocess queue.
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();
  }
}
```

New way ( similar to what we do for the driver implementation )
```
EXPECT_CALL(callbacks, heartbeat())
    .WillRepeatedly(Return()); // Ignore heartbeats.
```


Diffs
-----

  src/tests/mesos.hpp 3e58b454c75a2ab9f8b4a29785fa823afefd0c8a 
  src/tests/scheduler_tests.cpp 7946cb48d62f4ed6d0fdbc771746518e31921f97 

Diff: https://reviews.apache.org/r/39372/diff/


Testing
-------

make check ( I only modified a couple of existing tests to show the new interface usage. If the interface looks good, would go ahead and modify all the tests )


Thanks,

Anand Mazumdar


Re: Review Request 39372: Introduced a callback interface for testing the Scheduler Library

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39372/#review102874
-----------------------------------------------------------


Patch looks great!

Reviews applied: [39372]

All tests passed.

- Mesos ReviewBot


On Oct. 16, 2015, 2:49 a.m., Anand Mazumdar wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39372/
> -----------------------------------------------------------
> 
> (Updated Oct. 16, 2015, 2:49 a.m.)
> 
> 
> Review request for mesos, Ben Mahler, Isabel Jimenez, and Vinod Kone.
> 
> 
> Bugs: MESOS-3339
>     https://issues.apache.org/jira/browse/MESOS-3339
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Instead of introducing a `DROP_HTTP_EVENT` filtering abstraction, made the existing interface callback based that allows to use the already existing testing semantics. Also, the new interface allows us to use a generic interface across scheduler library versions.
> 
> This gets rid of the following hack:
> ```
> // Enqueues all received events into a libprocess queue.
> 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();
>   }
> }
> ```
> 
> New way ( similar to what we do for the driver implementation )
> ```
> EXPECT_CALL(callbacks, heartbeat())
>     .WillRepeatedly(Return()); // Ignore heartbeats.
> ```
> 
> 
> Diffs
> -----
> 
>   src/tests/mesos.hpp 3e58b454c75a2ab9f8b4a29785fa823afefd0c8a 
>   src/tests/scheduler_tests.cpp 7946cb48d62f4ed6d0fdbc771746518e31921f97 
> 
> Diff: https://reviews.apache.org/r/39372/diff/
> 
> 
> Testing
> -------
> 
> make check ( I only modified a couple of existing tests to show the new interface usage. If the interface looks good, would go ahead and modify all the tests )
> 
> 
> Thanks,
> 
> Anand Mazumdar
> 
>


Re: Review Request 39372: Introduced a callback interface for testing the scheduler library.

Posted by Vinod Kone <vi...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39372/#review121053
-----------------------------------------------------------


Ship it!




Ship It!

- Vinod Kone


On Feb. 22, 2016, 8:19 p.m., Anand Mazumdar wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39372/
> -----------------------------------------------------------
> 
> (Updated Feb. 22, 2016, 8:19 p.m.)
> 
> 
> Review request for mesos and Vinod Kone.
> 
> 
> Bugs: MESOS-3339
>     https://issues.apache.org/jira/browse/MESOS-3339
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This change adds a new callback based testing interface for the scheduler library similar to the already existing one for the executor library.
> 
> This gets rid of the following hack:
> ```cpp
> 
> // Enqueues all received events into a libprocess queue.
> 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();
>   }
> }
> 
> ```
> 
> New way ( similar to what we do for the driver implementation )
> ```cpp
> 
> EXPECT_CALL(callbacks, heartbeat())
>     .WillRepeatedly(Return()); // Ignore heartbeats.
>     
> ```
> 
> 
> Diffs
> -----
> 
>   src/tests/mesos.hpp 242a11658c0a9ba4caced9b2b2bdbcb921f7fdd0 
> 
> Diff: https://reviews.apache.org/r/39372/diff/
> 
> 
> Testing
> -------
> 
> make check (Would modify the tests to use the new interface in a subsequent change)
> 
> 
> Thanks,
> 
> Anand Mazumdar
> 
>


Re: Review Request 39372: Introduced a callback interface for testing the scheduler library.

Posted by Anand Mazumdar <ma...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39372/
-----------------------------------------------------------

(Updated Feb. 22, 2016, 8:19 p.m.)


Review request for mesos and Vinod Kone.


Changes
-------

Make this stale review for scheduler callbacks alive again.


Summary (updated)
-----------------

Introduced a callback interface for testing the scheduler library.


Bugs: MESOS-3339
    https://issues.apache.org/jira/browse/MESOS-3339


Repository: mesos


Description (updated)
-------

This change adds a new callback based testing interface for the scheduler library similar to the already existing one for the executor library.

This gets rid of the following hack:
```cpp

// Enqueues all received events into a libprocess queue.
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();
  }
}

```

New way ( similar to what we do for the driver implementation )
```cpp

EXPECT_CALL(callbacks, heartbeat())
    .WillRepeatedly(Return()); // Ignore heartbeats.
    
```


Diffs (updated)
-----

  src/tests/mesos.hpp 242a11658c0a9ba4caced9b2b2bdbcb921f7fdd0 

Diff: https://reviews.apache.org/r/39372/diff/


Testing (updated)
-------

make check (Would modify the tests to use the new interface in a subsequent change)


Thanks,

Anand Mazumdar