Scheduler tests (ready for review)

Functional tests for the scheduler