Skip to content

Commit e740361

Browse files
committed
Merged pull request #906
2 parents d850868 + 7d1ac7b commit e740361

40 files changed

+179
-21
lines changed

.travis.scripts/setup_mo.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ case $DEPLOYMENT in
2727
${TRAVIS_BUILD_DIR}/.travis.scripts/mo.sh ${TRAVIS_BUILD_DIR}/scripts/presets/travis/replica_sets/replicaset.json start > /tmp/mo-result.json
2828
cat /tmp/mo-result.json | tail -n 1 | php -r 'echo json_decode(file_get_contents("php://stdin"))->mongodb_uri;' > /tmp/uri.txt
2929
;;
30+
REPLICASET_SINGLE)
31+
${TRAVIS_BUILD_DIR}/.travis.scripts/mo.sh ${TRAVIS_BUILD_DIR}/scripts/presets/travis/replica_sets/replicaset-one-node.json start > /tmp/mo-result.json
32+
cat /tmp/mo-result.json | tail -n 1 | php -r 'echo json_decode(file_get_contents("php://stdin"))->mongodb_uri;' > /tmp/uri.txt
33+
;;
3034
REPLICASET_OLD)
3135
${TRAVIS_BUILD_DIR}/.travis.scripts/mo.sh ${TRAVIS_BUILD_DIR}/scripts/presets/travis/replica_sets/replicaset-old.json start > /tmp/mo-result.json
3236
cat /tmp/mo-result.json | tail -n 1 | php -r 'echo json_decode(file_get_contents("php://stdin"))->mongodb_uri;' > /tmp/uri.txt

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ matrix:
4040
- php: 7.2
4141
env:
4242
- DEPLOYMENT=REPLICASET
43+
- php: 7.2
44+
env:
45+
- DEPLOYMENT=REPLICASET_SINGLE
4346
- php: 7.2
4447
env:
4548
- SERVER_VERSION=3.0.15
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"id": "REPLICASET_SINGLE",
3+
"name": "mongod",
4+
"members": [
5+
{
6+
"procParams": {
7+
"dbpath": "/tmp/REPLICASET/3020/",
8+
"ipv6": true,
9+
"logappend": true,
10+
"logpath": "/tmp/REPLICASET/3020/mongod.log",
11+
"journal": true,
12+
"nssize": 1,
13+
"port": 3020,
14+
"bind_ip_all": true,
15+
"smallfiles": true
16+
},
17+
"rsParams": {
18+
"priority": 99,
19+
"tags": {
20+
"ordinal": "one",
21+
"dc": "pa"
22+
}
23+
},
24+
"server_id": "RS-alone"
25+
}
26+
]
27+
}

tests/connect/replicaset-seedlist-001.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
--TEST--
22
MongoDB\Driver\Manager: Connecting to Replica Set with only secondary in seedlist
3-
--XFAIL--
4-
replica set seedlist tests must be reimplemented (PHPC-1173)
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_replica_set(); ?>
6+
<?php skip_if_no_secondary(); ?>
87
<?php skip_if_not_clean(); ?>
9-
<?php PREDICTABLE(); ?>
108
--FILE--
119
<?php
1210
require_once __DIR__ . "/../utils/basic.inc";
1311

12+
$secondary = get_secondary_server(URI);
13+
$info = $secondary->getInfo();
1414

15-
$dsn = "mongodb://192.168.112.10:3001/?replicaSet=REPLICASET";
16-
$manager = new MongoDB\Driver\Manager($dsn);
15+
$dsn = 'mongodb://' . $info['me'];
16+
$manager = new MongoDB\Driver\Manager($dsn, ['replicaSet' => $info['setName']]);
1717

1818
// load fixtures for test
1919
$bulk = new \MongoDB\Driver\BulkWrite();

tests/connect/replicaset-seedlist-002.phpt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
--TEST--
22
MongoDB\Driver\Manager: Connecting to Replica Set with only arbiter in seedlist
3-
--XFAIL--
4-
replica set seedlist tests must be reimplemented (PHPC-1173)
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_replica_set(); ?>
6+
<?php skip_if_no_arbiter(); ?>
87
<?php skip_if_not_clean(); ?>
9-
<?php PREDICTABLE(); ?>
108
--FILE--
119
<?php
1210
require_once __DIR__ . "/../utils/basic.inc";
1311

12+
$primary = get_primary_server(URI);
13+
$info = $primary->getInfo();
1414

15-
$dsn = "mongodb://192.168.112.10:3002/?replicaSet=REPLICASET";
16-
$manager = new MongoDB\Driver\Manager($dsn);
15+
// We already checked whether there is an arbiter through `skip_if_no_arbiter`
16+
$dsn = 'mongodb://' . $info['arbiters'][0];
17+
18+
$manager = new MongoDB\Driver\Manager($dsn, ['replicaSet' => $info['setName']]);
1719

1820
// load fixtures for test
1921
$bulk = new \MongoDB\Driver\BulkWrite();

tests/manager/manager-executeBulkWrite-012.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ MongoDB\Driver\Manager::executeBulkWrite() with legacy write concern (replica se
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
55
<?php skip_if_not_replica_set(); ?>
6+
<?php skip_if_not_enough_data_nodes(2); ?>
67
<?php skip_if_not_clean(); ?>
78
--FILE--
89
<?php

tests/manager/manager-executeCommand-002.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ MongoDB\Driver\Manager::executeCommand() takes a read preference in options arra
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
55
<?php skip_if_not_replica_set(); ?>
6+
<?php skip_if_no_secondary(); ?>
67
<?php skip_if_not_clean(); ?>
78
--FILE--
89
<?php

tests/manager/manager-executeCommand-003.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ MongoDB\Driver\Manager::executeCommand() takes a read preference as legacy optio
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
55
<?php skip_if_not_replica_set(); ?>
6+
<?php skip_if_no_secondary(); ?>
67
<?php skip_if_not_clean(); ?>
78
--FILE--
89
<?php

tests/manager/manager-executeCommand-004.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ MongoDB\Driver\Manager::executeCommand() options (MONGOC_CMD_RAW)
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
55
<?php skip_if_not_live(); ?>
6+
<?php skip_if_not_replica_set(); ?>
7+
<?php skip_if_no_secondary(); ?>
68
<?php skip_if_not_clean(); ?>
79
<?php skip_if_server_version('<', '3.6'); ?>
810
--FILE--

tests/manager/manager-executeQuery-003.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ MongoDB\Driver\Manager::executeQuery() takes a read preference in options array
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
55
<?php skip_if_not_replica_set(); ?>
6+
<?php skip_if_no_secondary(); ?>
67
<?php skip_if_not_clean(); ?>
78
--FILE--
89
<?php

0 commit comments

Comments
 (0)