File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
13
13
"code.gitea.io/gitea/models"
14
14
"code.gitea.io/gitea/modules/setting"
15
+ "gopkg.in/ini.v1"
15
16
16
17
"github.com/stretchr/testify/assert"
17
18
)
@@ -22,10 +23,12 @@ func TestMain(m *testing.M) {
22
23
23
24
func TestBleveSearchIssues (t * testing.T ) {
24
25
assert .NoError (t , models .PrepareTestDatabase ())
26
+ setting .Cfg = ini .Empty ()
25
27
26
28
os .RemoveAll (setting .Indexer .IssueQueueDir )
27
29
os .RemoveAll (setting .Indexer .IssuePath )
28
30
setting .Indexer .IssueType = "bleve"
31
+ setting .NewQueueService ()
29
32
InitIssueIndexer (true )
30
33
31
34
time .Sleep (5 * time .Second )
Original file line number Diff line number Diff line change 4
4
5
5
package queue
6
6
7
- import "testing"
7
+ import (
8
+ "encoding/json"
9
+ "testing"
8
10
9
- import "github.com/stretchr/testify/assert"
10
-
11
- import "encoding/json"
11
+ "github.com/stretchr/testify/assert"
12
+ )
12
13
13
14
type testData struct {
14
15
TestString string
Original file line number Diff line number Diff line change @@ -115,7 +115,9 @@ func getQueueSettings(name string) queueSettings {
115
115
return q
116
116
}
117
117
118
- func newQueueService () {
118
+ // NewQueueService sets up the default settings for Queues
119
+ // This is exported for tests to be able to use the queue
120
+ func NewQueueService () {
119
121
sec := Cfg .Section ("queue" )
120
122
Queue .DataDir = sec .Key ("DATADIR" ).MustString ("queues/" )
121
123
if ! path .IsAbs (Queue .DataDir ) {
Original file line number Diff line number Diff line change @@ -1090,5 +1090,5 @@ func NewServices() {
1090
1090
newMigrationsService ()
1091
1091
newIndexerService ()
1092
1092
newTaskService ()
1093
- newQueueService ()
1093
+ NewQueueService ()
1094
1094
}
You can’t perform that action at this time.
0 commit comments