Add test db interface, fix test errors