mirror of
https://github.com/go-gitea/gitea.git
synced 2025-02-02 15:09:33 -05:00
Fix test
This commit is contained in:
parent
cc123c3448
commit
1013ced326
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
"gopkg.in/ini.v1"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@ -24,6 +25,7 @@ func TestMain(m *testing.M) {
|
|||||||
|
|
||||||
func TestBleveSearchIssues(t *testing.T) {
|
func TestBleveSearchIssues(t *testing.T) {
|
||||||
assert.NoError(t, models.PrepareTestDatabase())
|
assert.NoError(t, models.PrepareTestDatabase())
|
||||||
|
setting.Cfg = ini.Empty()
|
||||||
|
|
||||||
tmpIndexerDir, err := ioutil.TempDir("", "issues-indexer")
|
tmpIndexerDir, err := ioutil.TempDir("", "issues-indexer")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -41,6 +43,7 @@ func TestBleveSearchIssues(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
setting.Indexer.IssueType = "bleve"
|
setting.Indexer.IssueType = "bleve"
|
||||||
|
setting.NewQueueService()
|
||||||
InitIssueIndexer(true)
|
InitIssueIndexer(true)
|
||||||
defer func() {
|
defer func() {
|
||||||
indexer := holder.get()
|
indexer := holder.get()
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
package queue
|
package queue
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"testing"
|
||||||
|
|
||||||
import "github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
import "encoding/json"
|
|
||||||
|
|
||||||
type testData struct {
|
type testData struct {
|
||||||
TestString string
|
TestString string
|
||||||
|
@ -115,7 +115,9 @@ func getQueueSettings(name string) queueSettings {
|
|||||||
return q
|
return q
|
||||||
}
|
}
|
||||||
|
|
||||||
func newQueueService() {
|
// NewQueueService sets up the default settings for Queues
|
||||||
|
// This is exported for tests to be able to use the queue
|
||||||
|
func NewQueueService() {
|
||||||
sec := Cfg.Section("queue")
|
sec := Cfg.Section("queue")
|
||||||
Queue.DataDir = sec.Key("DATADIR").MustString("queues/")
|
Queue.DataDir = sec.Key("DATADIR").MustString("queues/")
|
||||||
if !path.IsAbs(Queue.DataDir) {
|
if !path.IsAbs(Queue.DataDir) {
|
||||||
|
@ -1090,5 +1090,5 @@ func NewServices() {
|
|||||||
newMigrationsService()
|
newMigrationsService()
|
||||||
newIndexerService()
|
newIndexerService()
|
||||||
newTaskService()
|
newTaskService()
|
||||||
newQueueService()
|
NewQueueService()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user