mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Decouple unit test code from business code (#17623)
This commit is contained in:
@@ -8,14 +8,14 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestBleveIndexAndSearch(t *testing.T) {
|
||||
db.PrepareTestEnv(t)
|
||||
unittest.PrepareTestEnv(t)
|
||||
|
||||
dir, err := os.MkdirTemp("", "bleve.index")
|
||||
assert.NoError(t, err)
|
||||
|
@@ -8,12 +8,13 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestESIndexAndSearch(t *testing.T) {
|
||||
db.PrepareTestEnv(t)
|
||||
unittest.PrepareTestEnv(t)
|
||||
|
||||
u := os.Getenv("TEST_INDEXER_CODE_ES_URL")
|
||||
if u == "" {
|
||||
|
@@ -8,12 +8,13 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
db.MainTest(m, filepath.Join("..", "..", ".."))
|
||||
unittest.MainTest(m, filepath.Join("..", "..", ".."))
|
||||
}
|
||||
|
||||
func testIndexer(name string, t *testing.T, indexer Indexer) {
|
||||
|
Reference in New Issue
Block a user