summaryrefslogtreecommitdiffstats
path: root/modules/indexer/issues/bleve_test.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-12-28 02:08:05 +0000
committerLunny Xiao <xiaolunwen@gmail.com>2019-12-28 10:08:05 +0800
commit55cd33e124e152869fa2f2dc420e6a5be98a3cbe (patch)
tree85f9b800248c202d024c7b6b6c1dc37243782f58 /modules/indexer/issues/bleve_test.go
parent884173232fa036b032f77d5a10d78e695e96b5de (diff)
downloadgitea-55cd33e124e152869fa2f2dc420e6a5be98a3cbe.tar.gz
gitea-55cd33e124e152869fa2f2dc420e6a5be98a3cbe.zip
Stop various tests from adding to the source tree (#9515)
Instead of just adding test generated files to .gitignore prevent them from being produced in the first place. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/indexer/issues/bleve_test.go')
-rw-r--r--modules/indexer/issues/bleve_test.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/modules/indexer/issues/bleve_test.go b/modules/indexer/issues/bleve_test.go
index 94d935d89d..234da076cd 100644
--- a/modules/indexer/issues/bleve_test.go
+++ b/modules/indexer/issues/bleve_test.go
@@ -5,6 +5,7 @@
package issues
import (
+ "io/ioutil"
"os"
"testing"
@@ -12,12 +13,20 @@ import (
)
func TestBleveIndexAndSearch(t *testing.T) {
- dir := "./bleve.index"
- indexer := NewBleveIndexer(dir)
+ dir, err := ioutil.TempDir("", "bleve.index")
+ assert.NoError(t, err)
+ if err != nil {
+ assert.Fail(t, "Unable to create temporary directory")
+ return
+ }
defer os.RemoveAll(dir)
+ indexer := NewBleveIndexer(dir)
+ defer indexer.Close()
- _, err := indexer.Init()
- assert.NoError(t, err)
+ if _, err := indexer.Init(); err != nil {
+ assert.Fail(t, "Unable to initialise bleve indexer: %v", err)
+ return
+ }
err = indexer.Index([]*IndexerData{
{