mesos/spark — pull request #458 by stephenh (2013-02-09 22:52:41+00:00)
Title: Use stubs instead of mocks for DAGSchedulerSuite.

@woggling @mateiz This is still in "request for comment state", but I took a crack at changing the DAGSchedulerSuite over from mocks to stubs.

I admittedly have a somewhat obsessive fascination with stubs, in that I think they can lead to simpler behavior than mocks and so make the tests easier to read.

This is because with stubs the state is being passed around much more directly, instead of juggling with the mock framework's expect abstractions.

Still outstanding is a few assertions I need to put back, and then stubbing out DAGScheduler's use of "new Thread" in it's run local mode, either by introducing a "LocalRunner" abstraction, or, more likely, just overriding DAGScheduler.runLocally to invoke job.func immediately (so the test doesn't have to wait for the thread to do it).

This would remove the last bit of "waiting on threads" behavior (the Thread.sleep hack I have now) and mean everything happens (for the unit test) synchronously/immediately.

I can continue to clean this up if you want, but thought since I have all of the existing tests ported over and passing, it would be a good place to check in.