Reduce integration test overhead (#32475)
In profiling integration tests, I found a couple places where per-test overhead could be reduced: * Avoiding disk IO by synchronizing instead of deleting & copying test Git repository data. This saves ~100ms per test on my machine * When flushing queues in `PrintCurrentTest`, invoke `FlushWithContext` in a parallel. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
249e67672a
commit
68731c07c5
102 changed files with 104 additions and 465 deletions
|
@ -21,6 +21,7 @@ import (
|
|||
_ "code.gitea.io/gitea/models/activities"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
@ -284,15 +285,11 @@ func TestBleveIndexAndSearch(t *testing.T) {
|
|||
dir := t.TempDir()
|
||||
|
||||
idx := bleve.NewIndexer(dir)
|
||||
_, err := idx.Init(context.Background())
|
||||
if err != nil {
|
||||
if idx != nil {
|
||||
idx.Close()
|
||||
}
|
||||
assert.FailNow(t, "Unable to create bleve indexer Error: %v", err)
|
||||
}
|
||||
defer idx.Close()
|
||||
|
||||
_, err := idx.Init(context.Background())
|
||||
require.NoError(t, err)
|
||||
|
||||
testIndexer("beleve", t, idx)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue