gitserver: fix cleanup tests
Created by: stefanhengl
Some of the tests in cleanup_test.go fail if run separately or with go test -short ./...
because we don't set up the DB before calling cleanupRepos()
.
This was masked by a global sync.Once
protecting setRepoSizes
: the first test that ran set up the DB and triggered the sync.Once
, the other tests didn't call the DB anymore because setRepoSizes
was skipped.
Test plan
- I ran the test suite locally with
git test -short ./...
- I ran the tests in cleanup_test.go individually