Skip to content

Commit

Permalink
Improve test after merging mongodb#1118
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Jul 24, 2023
1 parent b386083 commit dc5b647
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/Collection/SearchIndexFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ public function testIndexLifecycle(): void
$this->assertSame($name, $createdName);

// Wait for the index to be ready
$count = 0;
$maxWaitingTime = 90;
do {
sleep(1);
$result = $collection->listSearchIndexes($name);
$this->assertInstanceOf(CachingIterator::class, $result);
$index = $result->current();

if ($count++ > 90) {
if ($maxWaitingTime-- <= 0) {
$this->fail('Search index did not become queryable');
}
} while (! $index->queryable);
Expand All @@ -84,16 +84,16 @@ public function testIndexLifecycle(): void
$collection->dropSearchIndex($name);

// Wait for the index to be deleted
$count = 0;
$maxWaitingTime = 90;
do {
sleep(1);
$result = $collection->listSearchIndexes($name);
$this->assertInstanceOf(CachingIterator::class, $result);

if ($count++ > 90) {
if ($maxWaitingTime-- <= 0) {
$this->fail('Search index was not deleted');
}
} while ($result->valid());
} while ($result->count() !== 0);
}

/**
Expand Down

0 comments on commit dc5b647

Please sign in to comment.