Added a drain for the page queue and added support for test mode