Switch to dbtest.NewDB in batches codebase
Created by: eseliger
Stacked on top of https://github.com/sourcegraph/sourcegraph/pull/21397, this PR refactors usages of dbtesting.GetDB
to dbtest.NewDB
after @camdencheek has improved its performance quite substantially.
After
? github.com/sourcegraph/sourcegraph/enterprise/internal/batches [no test files]
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/background 2.441s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/global 0.430s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/reconciler 4.023s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/resolvers 11.064s
? github.com/sourcegraph/sourcegraph/enterprise/internal/batches/resolvers/apitest [no test files]
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/rewirer 0.775s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/scheduler 0.299s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/search 0.372s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/search/syntax 0.238s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/service 4.880s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/sources 1.079s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/state 0.690s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/store 3.266s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/syncer 1.471s
? github.com/sourcegraph/sourcegraph/enterprise/internal/batches/testing [no test files]
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/types 0.770s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/types/scheduler/config 0.248s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/types/scheduler/window 0.205s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/webhooks 3.402s
Before
? github.com/sourcegraph/sourcegraph/enterprise/internal/batches [no test files]
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/background 6.593s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/global 0.941s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/reconciler 7.328s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/resolvers 14.464s
? github.com/sourcegraph/sourcegraph/enterprise/internal/batches/resolvers/apitest [no test files]
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/rewirer 0.634s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/scheduler 0.501s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/search 0.284s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/search/syntax 0.135s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/service 6.907s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/sources 1.428s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/state 0.435s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/store 5.897s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/syncer 0.694s
? github.com/sourcegraph/sourcegraph/enterprise/internal/batches/testing [no test files]
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/types 1.108s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/types/scheduler/config 0.317s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/types/scheduler/window 0.181s
ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/webhooks 6.586s
Single test performance also got a lot better:
After: ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/store 1.725s
Before: ok github.com/sourcegraph/sourcegraph/enterprise/internal/batches/store 4.046s