diff options
author | zeripath <art27@cantab.net> | 2019-12-28 03:08:05 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-12-28 03:08:05 +0100 |
commit | 55cd33e124e152869fa2f2dc420e6a5be98a3cbe (patch) | |
tree | 85f9b800248c202d024c7b6b6c1dc37243782f58 /modules/indexer/issues/bleve_test.go | |
parent | Add contrib/environment-to-ini (#9519) (diff) | |
download | forgejo-55cd33e124e152869fa2f2dc420e6a5be98a3cbe.tar.xz forgejo-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.go | 17 |
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{ { |