Add tests for db indexer in indexer_test.go #27087
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As described in the title.
Some points:
Because
buildIssueOverview
is not well tested, there are several continuous bugs in the issue overview webpage.It's hard to put those tests in
./modules/indexer/issue/db/db_test.go
because those tests need 'real' data in db mocked by fixtures instead of random data in./modules/indexer/issue/internal/tests
. When using 'real' data(unittest.PrepareTestDatabase
),InitIssueIndexer
and the packageinit()
function ofindexer
are required to init indexer.The other three indexer engines are well tested by random data and it's okay to also test them with 'real' data in db mocked by fixtures. Any follow-up PR is welcome.
TestAPISearchIssues
inapi_test_issue.go
andTestIssues
inhome_test.go