File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -383,23 +383,35 @@ func TestDelete(t *testing.T) {
383383 err = c .IndexOptions (DefaultIndexingOptions , doc )
384384 assert .Nil (t , err )
385385
386- // now we should have 1 document (id = doc1)
386+ // Wait for all documents to be indexed
387387 info , err = c .Info ()
388388 assert .Nil (t , err )
389- if ! info .IsIndexing {
390- assert .Equal (t , uint64 (1 ), info .DocCount )
389+ for info .IsIndexing {
390+ time .Sleep (time .Second )
391+ info , err = c .Info ()
392+ assert .Nil (t , err )
391393 }
392394
395+ // now we should have 1 document (id = doc1)
396+ info , err = c .Info ()
397+ assert .Nil (t , err )
398+ assert .Equal (t , uint64 (1 ), info .DocCount )
399+
393400 // delete the document from the index
394401 err = c .Delete ("TestDelete-doc1" , true )
395402 assert .Nil (t , err )
396403
397- // validate that the index is empty again
404+ // Wait for all documents to be indexed
398405 info , err = c .Info ()
399406 assert .Nil (t , err )
400- if ! info .IsIndexing {
401- assert .Equal (t , uint64 (0 ), info .DocCount )
407+ for info .IsIndexing {
408+ time .Sleep (time .Second )
409+ info , err = c .Info ()
410+ assert .Nil (t , err )
402411 }
412+
413+ assert .Nil (t , err )
414+ assert .Equal (t , uint64 (0 ), info .DocCount )
403415 teardown (c )
404416}
405417
You can’t perform that action at this time.
0 commit comments