Skip to content

Commit 6500e8f

Browse files
committed
Remove MONGODB_ATLAS_URI
1 parent 97a7482 commit 6500e8f

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

tests/Collection/SearchIndexFunctionalTest.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use MongoDB\Model\CachingIterator;
66
use MongoDB\Tests\FunctionalTestCase;
7+
use MongoDB\Tests\TestCase;
78

89
use function bin2hex;
9-
use function getenv;
1010
use function preg_match;
1111
use function random_bytes;
1212
use function sleep;
@@ -19,22 +19,15 @@ class SearchIndexFunctionalTest extends FunctionalTestCase
1919
{
2020
private const ATLAS_TLD = '/\.(mongodb\.net|mongodb-dev\.net)/';
2121

22-
/**
23-
* Connect to a MongoDB Atlas Server.
24-
*/
2522
public static function getUri($allowMultipleMongoses = false): string
2623
{
27-
$atlasUri = getenv('MONGODB_ATLAS_URI');
28-
29-
if (! $atlasUri) {
30-
self::markTestSkipped('MONGODB_ATLAS_URI environment variable is not set');
31-
}
24+
$uri = TestCase::getUri();
3225

33-
if (! preg_match(self::ATLAS_TLD, $atlasUri)) {
34-
self::fail('MONGODB_ATLAS_URI is not an Atlas URI');
26+
if (! preg_match(self::ATLAS_TLD, $uri)) {
27+
self::markTestSkipped('Search Indexes are only supported on MongoDB Atlas');
3528
}
3629

37-
return $atlasUri;
30+
return $uri;
3831
}
3932

4033
public function testCreateSearchIndexesWithEmptyList(): void
@@ -53,6 +46,9 @@ public function testCreateSearchIndexWithDefaultName(): void
5346
$this->assertSame('default', $name);
5447
}
5548

49+
/**
50+
* This test can take up to 3 minutes to finish. Search index management are async operations.
51+
*/
5652
public function testIndexLifecycle(): void
5753
{
5854
$collection = $this->createCollection($this->getDatabaseName(), $this->getCollectionName());
@@ -63,7 +59,7 @@ public function testIndexLifecycle(): void
6359
$this->assertSame($name, $createdName);
6460

6561
// Wait for the index to be ready
66-
$maxWaitingTime = 90;
62+
$maxWaitingTime = 120;
6763
do {
6864
sleep(1);
6965
$result = $collection->listSearchIndexes($name);

tests/UnifiedSpecTests/Operation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,9 @@ function (IndexInfo $info) {
559559

560560
case 'createSearchIndex':
561561
$options = [];
562-
if (isset($args['name'])) {
563-
assertIsString($args['name']);
564-
$options['name'] = $args['name'];
562+
if (isset($args['model']->name)) {
563+
assertIsString($args['model']->name);
564+
$options['name'] = $args['model']->name;
565565
}
566566

567567
return $collection->createSearchIndex($args['model']->definition, $options);

0 commit comments

Comments
 (0)