1
1
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:
wxiaoguang
2021-11-12 22:36:47 +08:00
committed by GitHub
parent 7f802631c5
commit df64fa4865
136 changed files with 1058 additions and 830 deletions

View File

@@ -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)

View File

@@ -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 == "" {

View File

@@ -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) {