Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
8abb006e
Commit
8abb006e
authored
Aug 22, 2018
by
Derick Rethans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use server version as FCV when connected to mongos
parent
a949df52
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
FunctionalTestCase.php
tests/FunctionalTestCase.php
+15
-1
ModifyCollectionFunctionalTest.php
tests/Operation/ModifyCollectionFunctionalTest.php
+1
-3
No files found.
tests/FunctionalTestCase.php
View file @
8abb006e
...
@@ -8,6 +8,7 @@ use MongoDB\Driver\Manager;
...
@@ -8,6 +8,7 @@ use MongoDB\Driver\Manager;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\Query
;
use
MongoDB\Driver\Query
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\CommandException
;
use
stdClass
;
use
stdClass
;
use
UnexpectedValueException
;
use
UnexpectedValueException
;
...
@@ -49,6 +50,10 @@ abstract class FunctionalTestCase extends TestCase
...
@@ -49,6 +50,10 @@ abstract class FunctionalTestCase extends TestCase
protected
function
getFeatureCompatibilityVersion
(
ReadPreference
$readPreference
=
null
)
protected
function
getFeatureCompatibilityVersion
(
ReadPreference
$readPreference
=
null
)
{
{
if
(
$this
->
isShardedCluster
())
{
return
$this
->
getServerVersion
(
$readPreference
);
}
if
(
version_compare
(
$this
->
getServerVersion
(),
'3.4.0'
,
'<'
))
{
if
(
version_compare
(
$this
->
getServerVersion
(),
'3.4.0'
,
'<'
))
{
return
$this
->
getServerVersion
(
$readPreference
);
return
$this
->
getServerVersion
(
$readPreference
);
}
}
...
@@ -115,6 +120,15 @@ abstract class FunctionalTestCase extends TestCase
...
@@ -115,6 +120,15 @@ abstract class FunctionalTestCase extends TestCase
throw
new
UnexpectedValueException
(
'Could not determine server storage engine'
);
throw
new
UnexpectedValueException
(
'Could not determine server storage engine'
);
}
}
protected
function
isShardedCluster
()
{
if
(
$this
->
getPrimaryServer
()
->
getType
()
==
Server
::
TYPE_MONGOS
)
{
return
true
;
}
return
false
;
}
protected
function
isShardedClusterUsingReplicasets
()
protected
function
isShardedClusterUsingReplicasets
()
{
{
$cursor
=
$this
->
getPrimaryServer
()
->
executeQuery
(
$cursor
=
$this
->
getPrimaryServer
()
->
executeQuery
(
...
@@ -195,7 +209,7 @@ abstract class FunctionalTestCase extends TestCase
...
@@ -195,7 +209,7 @@ abstract class FunctionalTestCase extends TestCase
}
}
// TODO: MongoDB 4.2 should support sharded clusters (see: PHPLIB-374)
// TODO: MongoDB 4.2 should support sharded clusters (see: PHPLIB-374)
if
(
$this
->
getPrimaryServer
()
->
getType
()
===
Server
::
TYPE_MONGOS
)
{
if
(
$this
->
isShardedCluster
()
)
{
$this
->
markTestSkipped
(
'Transactions are not supported on sharded clusters'
);
$this
->
markTestSkipped
(
'Transactions are not supported on sharded clusters'
);
}
}
...
...
tests/Operation/ModifyCollectionFunctionalTest.php
View file @
8abb006e
...
@@ -21,7 +21,7 @@ class ModifyCollectionFunctionalTest extends FunctionalTestCase
...
@@ -21,7 +21,7 @@ class ModifyCollectionFunctionalTest extends FunctionalTestCase
$this
->
getDatabaseName
(),
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$this
->
getCollectionName
(),
[
'index'
=>
[
'keyPattern'
=>
[
'lastAccess'
=>
1
],
'expireAfterSeconds'
=>
1000
]],
[
'index'
=>
[
'keyPattern'
=>
[
'lastAccess'
=>
1
],
'expireAfterSeconds'
=>
1000
]],
[
'typeMap'
=>
[
'root'
=>
'array'
]]
[
'typeMap'
=>
[
'root'
=>
'array'
,
'document'
=>
'array'
]]
);
);
$result
=
$modifyCollection
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$modifyCollection
->
execute
(
$this
->
getPrimaryServer
());
...
@@ -30,8 +30,6 @@ class ModifyCollectionFunctionalTest extends FunctionalTestCase
...
@@ -30,8 +30,6 @@ class ModifyCollectionFunctionalTest extends FunctionalTestCase
* non-primary shards that don't have chunks for the collection, the result contains a
* non-primary shards that don't have chunks for the collection, the result contains a
* "ns does not exist" error. */
* "ns does not exist" error. */
foreach
(
$result
[
'raw'
]
as
$shard
)
{
foreach
(
$result
[
'raw'
]
as
$shard
)
{
$shard
=
(
array
)
$shard
;
if
(
array_key_exists
(
'ok'
,
$shard
)
&&
$shard
[
'ok'
]
==
1
)
{
if
(
array_key_exists
(
'ok'
,
$shard
)
&&
$shard
[
'ok'
]
==
1
)
{
$this
->
assertSame
(
3
,
$shard
[
'expireAfterSeconds_old'
]);
$this
->
assertSame
(
3
,
$shard
[
'expireAfterSeconds_old'
]);
$this
->
assertSame
(
1000
,
$shard
[
'expireAfterSeconds_new'
]);
$this
->
assertSame
(
1000
,
$shard
[
'expireAfterSeconds_new'
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment