Skip to content

Commit 51c622f

Browse files
committed
Merged pull request #907
2 parents a72910a + 8a28fcb commit 51c622f

File tree

9 files changed

+92
-12
lines changed

9 files changed

+92
-12
lines changed

.travis.scripts/setup_mo.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
echo Loading MO for $DEPLOYMENT
44

5+
if [[ -z $TRAVIS_BUILD_DIR ]]; then
6+
TRAVIS_BUILD_DIR=`pwd`;
7+
fi
8+
59
case $DEPLOYMENT in
610
SHARDED_CLUSTER)
711
${TRAVIS_BUILD_DIR}/.travis.scripts/mo.sh ${TRAVIS_BUILD_DIR}/scripts/presets/travis/sharded_clusters/cluster.json start > /tmp/mo-result.json
@@ -23,6 +27,10 @@ case $DEPLOYMENT in
2327
${TRAVIS_BUILD_DIR}/.travis.scripts/mo.sh ${TRAVIS_BUILD_DIR}/scripts/presets/travis/replica_sets/replicaset.json start > /tmp/mo-result.json
2428
cat /tmp/mo-result.json | tail -n 1 | php -r 'echo json_decode(file_get_contents("php://stdin"))->mongodb_uri;' > /tmp/uri.txt
2529
;;
30+
REPLICASET_AUTH)
31+
${TRAVIS_BUILD_DIR}/.travis.scripts/mo.sh ${TRAVIS_BUILD_DIR}/scripts/presets/travis/replica_sets/replicaset-auth.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_auth_uri;' > /tmp/uri.txt
33+
;;
2634
REPLICASET_OLD)
2735
${TRAVIS_BUILD_DIR}/.travis.scripts/mo.sh ${TRAVIS_BUILD_DIR}/scripts/presets/travis/replica_sets/replicaset-old.json start > /tmp/mo-result.json
2836
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
@@ -33,6 +33,9 @@ matrix:
3333
- php: 7.2
3434
env:
3535
- DEPLOYMENT=REPLICASET
36+
- php: 7.2
37+
env:
38+
- DEPLOYMENT=REPLICASET_AUTH
3639
- php: 7.2
3740
env:
3841
- SERVER_VERSION=3.0.15
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"id": "REPLICASET_AUTH",
3+
"name": "mongod",
4+
"auth_key": "secret",
5+
"login": "root",
6+
"password": "toor",
7+
"members": [
8+
{
9+
"procParams": {
10+
"dbpath": "/tmp/REPLICASET/3010/",
11+
"ipv6": true,
12+
"logappend": true,
13+
"logpath": "/tmp/REPLICASET/3010/mongod.log",
14+
"journal": true,
15+
"nssize": 1,
16+
"port": 3010,
17+
"bind_ip_all": true,
18+
"smallfiles": true
19+
},
20+
"rsParams": {
21+
"priority": 99,
22+
"tags": {
23+
"ordinal": "one",
24+
"dc": "pa"
25+
}
26+
},
27+
"server_id": "RS-AUTH-one"
28+
},
29+
{
30+
"procParams": {
31+
"dbpath": "/tmp/REPLICASET/3011/",
32+
"ipv6": true,
33+
"logappend": true,
34+
"logpath": "/tmp/REPLICASET/3011/mongod.log",
35+
"journal": true,
36+
"nssize": 1,
37+
"port": 3011,
38+
"bind_ip_all": true,
39+
"smallfiles": true
40+
},
41+
"rsParams": {
42+
"priority": 1.1,
43+
"tags": {
44+
"ordinal": "two",
45+
"dc": "nyc"
46+
}
47+
},
48+
"server_id": "RS-AUTH-two"
49+
},
50+
{
51+
"procParams": {
52+
"dbpath": "/tmp/REPLICASET/3012/",
53+
"ipv6": true,
54+
"logappend": true,
55+
"logpath": "/tmp/REPLICASET/3012/mongod.log",
56+
"journal": true,
57+
"nssize": 1,
58+
"port": 3012,
59+
"bind_ip_all": true,
60+
"smallfiles": true
61+
},
62+
"rsParams": {
63+
"arbiterOnly": true
64+
65+
},
66+
"server_id": "RS-AUTH-arbiter"
67+
}
68+
]
69+
}

tests/connect/standalone-auth-0001.phpt renamed to tests/connect/standalone-auth-001.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Connect to MongoDB with using default auth mechanism
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
55
<?php skip_if_not_auth(); ?>
6+
<?php skip_if_not_auth_mechanism(null); ?>
67
<?php skip_if_not_clean(); ?>
78
--FILE--
89
<?php

tests/connect/standalone-auth-0002.phpt renamed to tests/connect/standalone-auth_error-001.phpt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
--TEST--
2-
Connect to MongoDB with using default auth mechanism #002
3-
--XFAIL--
4-
parse_url() tests must be reimplemented (PHPC-1177)
2+
Connect to MongoDB with using default auth mechanism and wrong password
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_auth(); ?>
6+
<?php skip_if_not_auth_mechanism(null); ?>
87
<?php skip_if_not_clean(); ?>
98
--FILE--
109
<?php
1110
require_once __DIR__ . "/../utils/basic.inc";
1211

1312
$username = "root";
14-
$password = "tooring";
13+
$password = "the-wrong-password";
1514
$database = "admin";
1615

1716
$parsed = parse_url(URI);

tests/manager/manager-set-uri-options-001.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
MongoDB\Driver\Manager: Logging into MongoDB using credentials from $options
3-
--XFAIL--
4-
parse_url() tests must be reimplemented (PHPC-1177)
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_auth(); ?>

tests/server/server-construct-001.phpt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
MongoDB\Driver\Server::__construct()
3-
--XFAIL--
4-
parse_url() tests must be reimplemented (PHPC-1177)
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_live(); ?>
@@ -10,7 +8,10 @@ parse_url() tests must be reimplemented (PHPC-1177)
108
<?php
119
require_once __DIR__ . "/../utils/basic.inc";
1210

13-
$parsed = parse_url(STANDALONE);
11+
/* For replica sets we need to do some extra work to get the primary */
12+
$uri = is_replica_set(URI) ? get_primary_server(URI)->getInfo()['me'] : URI;
13+
$parsed = parse_url($uri);
14+
1415
$manager = new MongoDB\Driver\Manager(URI);
1516

1617
$bulk = new \MongoDB\Driver\BulkWrite();

tests/server/server-executeBulkWrite-005.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ foreach ($writeConcerns as $wc) {
2424
var_dump($result->getInsertedCount());
2525
}
2626

27-
$command = new MongoDB\Driver\Command(array('drop' => COLLECTION_NAME));
28-
$server->executeCommand('local', $command);
27+
$bulk = new MongoDB\Driver\BulkWrite();
28+
$bulk->delete( (object) [] );
29+
$server->executeBulkWrite('local.' . COLLECTION_NAME, $bulk);
2930

3031
?>
3132
===DONE===

tests/utils/skipif.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function skip_if_not_auth_mechanism($authMechanism)
9797
{
9898
$uriAuthMechanism = get_uri_option(URI, 'authMechanism');
9999

100-
if ($uriAuthMechanism === null) {
100+
if ($uriAuthMechanism === null && $authMechanism !== null) {
101101
exit('skip URI is not using authMechanism');
102102
}
103103

0 commit comments

Comments
 (0)