mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-23 16:38:08 +02:00
93efe0aeb6
* Remove pre-3.6 server versions from Evergreen matrix * Remove skipped tests for pre-3.6 servers * Remove old mongo-orchestration configs and Evergreen tasks * Remove flaky replica set tests These tests assume a particular replica set member is always the primary, so tag assertions may fail if a different member is elected. The server-getTags-002.phpt test has more flexible assertions for replica set tags, so we can safely remove these tests.
57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
--TEST--
|
|
MongoDB\Driver\Manager::getServers() (replica set)
|
|
--SKIPIF--
|
|
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
|
|
<?php skip_if_not_replica_set(); ?>
|
|
<?php skip_if_not_enough_nodes(3, 3); ?>
|
|
<?php skip_if_no_arbiter(); ?>
|
|
--FILE--
|
|
<?php
|
|
require_once __DIR__ . "/../utils/basic.inc";
|
|
|
|
function assertServerType($type) {
|
|
$rsTypes = array(
|
|
MongoDB\Driver\Server::TYPE_RS_PRIMARY,
|
|
MongoDB\Driver\Server::TYPE_RS_SECONDARY,
|
|
MongoDB\Driver\Server::TYPE_RS_ARBITER,
|
|
);
|
|
|
|
if (in_array($type, $rsTypes, true)) {
|
|
printf("Found replica set server type: %d\n", $type);
|
|
} else {
|
|
printf("Unexpected server type: %d\n", $type);
|
|
}
|
|
}
|
|
|
|
$manager = create_test_manager();
|
|
|
|
$servers = $manager->getServers();
|
|
printf("Known servers: %d\n", count($servers));
|
|
|
|
echo "Pinging\n";
|
|
$command = new MongoDB\Driver\Command(array('ping' => 1));
|
|
$manager->executeCommand(DATABASE_NAME, $command);
|
|
|
|
$servers = $manager->getServers();
|
|
printf("Known servers: %d\n", count($servers));
|
|
|
|
foreach ($servers as $server) {
|
|
printf("Found server: %s:%d\n", $server->getHost(), $server->getPort());
|
|
assertServerType($server->getType());
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
Known servers: 0
|
|
Pinging
|
|
Known servers: 3
|
|
Found server: %s:%d
|
|
Found replica set server type: %r(4|5|6)%r
|
|
Found server: %s:%d
|
|
Found replica set server type: %r(4|5|6)%r
|
|
Found server: %s:%d
|
|
Found replica set server type: %r(4|5|6)%r
|
|
===DONE===
|