Add db tests for reusePreviousBuild