summaryrefslogtreecommitdiffstats
path: root/modules/indexer/issues/indexer_test.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2022-01-27 10:30:51 +0200
committerGitHub <noreply@github.com>2022-01-27 10:30:51 +0200
commit8038610a4279862a87e630e4f1d1077c510f9d15 (patch)
tree802489f8ddde899e76643ea157f9020f12ca1490 /modules/indexer/issues/indexer_test.go
parent2649eddcf0bb1190abab49c9d79ce19bfcf19e87 (diff)
downloadgitea-8038610a4279862a87e630e4f1d1077c510f9d15.tar.gz
gitea-8038610a4279862a87e630e4f1d1077c510f9d15.zip
Automatically pause queue if index service is unavailable (#15066)
* Handle keyword search error when issue indexer service is not available * Implement automatic disabling and resume of code indexer queue
Diffstat (limited to 'modules/indexer/issues/indexer_test.go')
-rw-r--r--modules/indexer/issues/indexer_test.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/modules/indexer/issues/indexer_test.go b/modules/indexer/issues/indexer_test.go
index ee6ebcdd18..d516615b56 100644
--- a/modules/indexer/issues/indexer_test.go
+++ b/modules/indexer/issues/indexer_test.go
@@ -5,6 +5,7 @@
package issues
import (
+ "context"
"os"
"path"
"path/filepath"
@@ -56,19 +57,19 @@ func TestBleveSearchIssues(t *testing.T) {
time.Sleep(5 * time.Second)
- ids, err := SearchIssuesByKeyword([]int64{1}, "issue2")
+ ids, err := SearchIssuesByKeyword(context.TODO(), []int64{1}, "issue2")
assert.NoError(t, err)
assert.EqualValues(t, []int64{2}, ids)
- ids, err = SearchIssuesByKeyword([]int64{1}, "first")
+ ids, err = SearchIssuesByKeyword(context.TODO(), []int64{1}, "first")
assert.NoError(t, err)
assert.EqualValues(t, []int64{1}, ids)
- ids, err = SearchIssuesByKeyword([]int64{1}, "for")
+ ids, err = SearchIssuesByKeyword(context.TODO(), []int64{1}, "for")
assert.NoError(t, err)
assert.ElementsMatch(t, []int64{1, 2, 3, 5, 11}, ids)
- ids, err = SearchIssuesByKeyword([]int64{1}, "good")
+ ids, err = SearchIssuesByKeyword(context.TODO(), []int64{1}, "good")
assert.NoError(t, err)
assert.EqualValues(t, []int64{1}, ids)
}
@@ -79,19 +80,19 @@ func TestDBSearchIssues(t *testing.T) {
setting.Indexer.IssueType = "db"
InitIssueIndexer(true)
- ids, err := SearchIssuesByKeyword([]int64{1}, "issue2")
+ ids, err := SearchIssuesByKeyword(context.TODO(), []int64{1}, "issue2")
assert.NoError(t, err)
assert.EqualValues(t, []int64{2}, ids)
- ids, err = SearchIssuesByKeyword([]int64{1}, "first")
+ ids, err = SearchIssuesByKeyword(context.TODO(), []int64{1}, "first")
assert.NoError(t, err)
assert.EqualValues(t, []int64{1}, ids)
- ids, err = SearchIssuesByKeyword([]int64{1}, "for")
+ ids, err = SearchIssuesByKeyword(context.TODO(), []int64{1}, "for")
assert.NoError(t, err)
assert.ElementsMatch(t, []int64{1, 2, 3, 5, 11}, ids)
- ids, err = SearchIssuesByKeyword([]int64{1}, "good")
+ ids, err = SearchIssuesByKeyword(context.TODO(), []int64{1}, "good")
assert.NoError(t, err)
assert.EqualValues(t, []int64{1}, ids)
}