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
90748471
Unverified
Commit
90748471
authored
Aug 08, 2019
by
Andreas Braun
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #663
parents
703401d0
870024ed
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
4 deletions
+41
-4
FunctionalTestCase.php
tests/FunctionalTestCase.php
+41
-0
WatchFunctionalTest.php
tests/Operation/WatchFunctionalTest.php
+0
-4
No files found.
tests/FunctionalTestCase.php
View file @
90748471
...
@@ -138,6 +138,14 @@ abstract class FunctionalTestCase extends TestCase
...
@@ -138,6 +138,14 @@ abstract class FunctionalTestCase extends TestCase
*/
*/
protected
function
configureFailPoint
(
$command
)
protected
function
configureFailPoint
(
$command
)
{
{
if
(
!
$this
->
isFailCommandSupported
())
{
$this
->
markTestSkipped
(
'failCommand is only supported on mongod >= 4.0.0 and mongos >= 4.1.5.'
);
}
if
(
!
$this
->
isFailCommandEnabled
())
{
$this
->
markTestSkipped
(
'The enableTestCommands parameter is not enabled.'
);
}
if
(
is_array
(
$command
))
{
if
(
is_array
(
$command
))
{
$command
=
(
object
)
$command
;
$command
=
(
object
)
$command
;
}
}
...
@@ -394,4 +402,37 @@ abstract class FunctionalTestCase extends TestCase
...
@@ -394,4 +402,37 @@ abstract class FunctionalTestCase extends TestCase
$operation
->
execute
(
$server
);
$operation
->
execute
(
$server
);
}
}
}
}
/**
* Checks if the failCommand command is supported on this server version
*
* @return bool
*/
private
function
isFailCommandSupported
()
{
$minVersion
=
$this
->
isShardedCluster
()
?
'4.1.5'
:
'4.0.0'
;
return
version_compare
(
$this
->
getServerVersion
(),
$minVersion
,
'>='
);
}
/**
* Checks if the failCommand command is enabled by checking the enableTestCommands parameter
*
* @return bool
*/
private
function
isFailCommandEnabled
()
{
try
{
$cursor
=
$this
->
manager
->
executeCommand
(
'admin'
,
new
Command
([
'getParameter'
=>
1
,
'enableTestCommands'
=>
1
])
);
$document
=
current
(
$cursor
->
toArray
());
}
catch
(
CommandException
$e
)
{
return
false
;
}
return
isset
(
$document
->
enableTestCommands
)
&&
$document
->
enableTestCommands
===
true
;
}
}
}
tests/Operation/WatchFunctionalTest.php
View file @
90748471
...
@@ -689,10 +689,6 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -689,10 +689,6 @@ class WatchFunctionalTest extends FunctionalTestCase
*/
*/
public
function
testNonResumableErrorCodes
(
$errorCode
)
public
function
testNonResumableErrorCodes
(
$errorCode
)
{
{
if
(
version_compare
(
$this
->
getServerVersion
(),
'4.0.0'
,
'<'
))
{
$this
->
markTestSkipped
(
'failCommand is not supported'
);
}
$this
->
configureFailPoint
([
$this
->
configureFailPoint
([
'configureFailPoint'
=>
'failCommand'
,
'configureFailPoint'
=>
'failCommand'
,
'mode'
=>
[
'times'
=>
1
],
'mode'
=>
[
'times'
=>
1
],
...
...
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