Skip to content

Commit

Permalink
[add] improved testing by indexing check
Browse files Browse the repository at this point in the history
  • Loading branch information
filipecosta90 committed Aug 9, 2020
1 parent 08e9562 commit 4958ddc
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions redisearch/redisearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,23 +383,35 @@ func TestDelete(t *testing.T) {
err = c.IndexOptions(DefaultIndexingOptions, doc)
assert.Nil(t, err)

// now we should have 1 document (id = doc1)
// Wait for all documents to be indexed
info, err = c.Info()
assert.Nil(t, err)
if !info.IsIndexing {
assert.Equal(t, uint64(1), info.DocCount)
for info.IsIndexing {
time.Sleep(time.Second)
info, err = c.Info()
assert.Nil(t, err)
}

// now we should have 1 document (id = doc1)
info, err = c.Info()
assert.Nil(t, err)
assert.Equal(t, uint64(1), info.DocCount)

// delete the document from the index
err = c.Delete("TestDelete-doc1", true)
assert.Nil(t, err)

// validate that the index is empty again
// Wait for all documents to be indexed
info, err = c.Info()
assert.Nil(t, err)
if !info.IsIndexing {
assert.Equal(t, uint64(0), info.DocCount)
for info.IsIndexing {
time.Sleep(time.Second)
info, err = c.Info()
assert.Nil(t, err)
}

assert.Nil(t, err)
assert.Equal(t, uint64(0), info.DocCount)
teardown(c)
}

Expand Down

0 comments on commit 4958ddc

Please sign in to comment.