mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-24 07:49:34 +02:00
test: run integration tests on random ports and speed up slow tests (#39842)
Integration test processes now get their own work directory, config file and random ports, so several runs can execute in parallel on one machine. The slowest tests also lose fixed sleeps and needlessly expensive setup, with their assertions kept. - Batch PostgreSQL sequence resets, the main per-test fixture cost there - Cheap hashing params in hash and OAuth2 fixture tests, full-cost vectors stay - Single fetch for negative Actions runner assertions instead of 1s polls - Queue flushes and backdated timestamps instead of sleeps - In-memory SQLite test journal, tmpfs for PostgreSQL in CI - E2E instance writes SSH keys into its work directory instead of `~/.ssh/authorized_keys`
This commit is contained in:
1 parent
d0c35bcd58
commit
1031e34987
42 files changed
+219
-179
No files matched your search
@@ -8,6 +8,7 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"slices"
|
||||
"testing"
|
||||
@@ -744,6 +745,9 @@ func countIndexerData(data map[int64]*internal.IndexerData, f func(v *internal.I
|
||||
// waitData waits for the indexer to index all data.
|
||||
// Some engines like Elasticsearch index data asynchronously, so we need to wait for a while.
|
||||
func waitData(t *testing.T, indexer internal.Indexer, total int64) {
|
||||
if refresher, ok := indexer.(interface{ Refresh(context.Context) error }); ok {
|
||||
require.NoError(t, refresher.Refresh(t.Context()))
|
||||
}
|
||||
assert.Eventually(t, func() bool {
|
||||
result, err := indexer.Search(t.Context(), &internal.SearchOptions{Paginator: &db.ListOptions{}})
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in new issue
Block a user