summaryrefslogtreecommitdiffstats
path: root/integrations/repo_search_test.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-05-23 17:00:07 +0100
committerGitHub <noreply@github.com>2019-05-23 17:00:07 +0100
commit54bd63cd5c5645202625368c185b645c7771f687 (patch)
tree3857c5c770ffd5ec3e3cdaa910150a47fd2f579e /integrations/repo_search_test.go
parent6eb53ac570ab9af51fc9cbd79f1db782edce57e0 (diff)
downloadgitea-54bd63cd5c5645202625368c185b645c7771f687.tar.gz
gitea-54bd63cd5c5645202625368c185b645c7771f687.zip
Change UpdateRepoIndex api to include watchers (#7012)
* Change UpdateRepoIndex api to include watchers * Add timeout
Diffstat (limited to 'integrations/repo_search_test.go')
-rw-r--r--integrations/repo_search_test.go23
1 files changed, 7 insertions, 16 deletions
diff --git a/integrations/repo_search_test.go b/integrations/repo_search_test.go
index 3422aeaa12..282caa707e 100644
--- a/integrations/repo_search_test.go
+++ b/integrations/repo_search_test.go
@@ -5,7 +5,6 @@
package integrations
import (
- "log"
"net/http"
"testing"
"time"
@@ -34,22 +33,14 @@ func TestSearchRepo(t *testing.T) {
repo, err := models.GetRepositoryByOwnerAndName("user2", "repo1")
assert.NoError(t, err)
- models.UpdateRepoIndexer(repo)
+ waiter := make(chan error, 1)
+ models.UpdateRepoIndexer(repo, waiter)
- log.Printf("Waiting for indexing\n")
-
- i := 0
- for i < 60 {
- if repo.IndexerStatus != nil && len(repo.IndexerStatus.CommitSha) != 0 {
- break
- }
- time.Sleep(1 * time.Second)
- i++
- }
- if i < 60 {
- log.Printf("Indexing took: %ds\n", i)
- } else {
- log.Printf("Waited the limit: %ds for indexing, continuing\n", i)
+ select {
+ case err := <-waiter:
+ assert.NoError(t, err)
+ case <-time.After(1 * time.Minute):
+ assert.Fail(t, "UpdateRepoIndexer took too long")
}
req := NewRequestf(t, "GET", "/user2/repo1/search?q=Description&page=1")