Skip to content

add database.DB interface to facilitate mocking out stores

Administrator requested to merge cc/database-interface into main

Created by: camdencheek

This adds the database.DB interface to facilitate mocking out the behavior of stores. The idea here is outlined in #26113. Essentially, rather than passing around dbutil.DB and wrapping it like database.Repos(db), we'd instead make Repos() a method on the database interface, allowing us to mock out its return value.

The lines changed is large, but the actually interesting changes are small. I've highlighted them with comments, and the commits in this PR are largely independent, but the change as a whole doesn't make much sense without hooking it up to anything, so this also includes changing a few tests to use the injected mocks instead of the global replacement mocks.

Merge request reports

Loading