Skip to content

Commit 5f23538

Browse files
committed
PHPC-1414: Skip tests when mongo orchestration is not available
1 parent 93141ed commit 5f23538

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

tests/cursor/cursor-getmore-005.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ MongoDB\Driver\Cursor query result iteration with getmore failure
1212
<?php skip_if_server_version(">=", "3.6"); ?>
1313
<?php skip_if_no_getmore_failpoint(); ?>
1414
<?php skip_if_auth(); ?>
15+
<?php skip_if_no_mongo_orchestration(); ?>
1516
--FILE--
1617
<?php
1718
require_once __DIR__ . "/../utils/basic.inc";

tests/cursor/cursor-getmore-006.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ MongoDB\Driver\Cursor command result iteration with getmore failure
1212
<?php skip_if_server_version(">=", "3.6"); ?>
1313
<?php skip_if_no_getmore_failpoint(); ?>
1414
<?php skip_if_auth(); ?>
15+
<?php skip_if_no_mongo_orchestration(); ?>
1516
--FILE--
1617
<?php
1718
require_once __DIR__ . "/../utils/basic.inc";

tests/cursor/cursor-getmore-007.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ MongoDB\Driver\Cursor query result iteration with getmore failure
1212
<?php skip_if_server_version("<", "3.6"); ?>
1313
<?php skip_if_no_getmore_failpoint(); ?>
1414
<?php skip_if_auth(); ?>
15+
<?php skip_if_no_mongo_orchestration(); ?>
1516
--FILE--
1617
<?php
1718
require_once __DIR__ . "/../utils/basic.inc";

tests/cursor/cursor-getmore-008.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ MongoDB\Driver\Cursor command result iteration with getmore failure
1212
<?php skip_if_server_version("<", "3.6"); ?>
1313
<?php skip_if_no_getmore_failpoint(); ?>
1414
<?php skip_if_auth(); ?>
15+
<?php skip_if_no_mongo_orchestration(); ?>
1516
--FILE--
1617
<?php
1718
require_once __DIR__ . "/../utils/basic.inc";

tests/utils/skipif.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,3 +356,16 @@ function skip_if_no_failcommand_failpoint()
356356
exit("skip mongod version '$serverVersion' does not support 'failCommand' failpoint'");
357357
}
358358
}
359+
360+
function skip_if_no_mongo_orchestration()
361+
{
362+
$ctx = stream_context_create(['http' => ['timeout' => 0.5]]);
363+
$result = @file_get_contents(MONGO_ORCHESTRATION_URI, false, $ctx);
364+
365+
/* Note: file_get_contents emits an E_WARNING on failure, which will be
366+
* caught by the error handler in basic-skipif.inc. In that case, this may
367+
* never be reached. */
368+
if ($result === false) {
369+
exit("skip mongo-orchestration is not accessible: '" . MONGO_ORCHESTRATION_URI . "'");
370+
}
371+
}

0 commit comments

Comments
 (0)