-
Notifications
You must be signed in to change notification settings - Fork 209
PHPC-1184: Add alternative topologies to Travis CI #871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPC-1184: Add alternative topologies to Travis CI #871
Conversation
2b74723
to
b63fb69
Compare
b63fb69
to
e36f03f
Compare
started: drop | ||
failed: drop | ||
started: geoNear | ||
failed: geoNear |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geoNear
is deprecated (PM-939). I think a more robust solution would just be to issue an aggregate
with an unsupported pipeline operator (e.g. [ { "$unsupported": 1 } ]
) or an update
with a similarly unsupported modifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will see if I can fix that.
tests/utils/tools.php
Outdated
* @return bool | ||
* @throws RuntimeException | ||
*/ | ||
function command_works($uri, $command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to type-hint $command
here?
Alternatively, allow it to take any array|object
and then wrap it in a Command as needed. This is what PHPLIB's DatabaseCommand
helper does. It would save you from needing to import and construct MongoDB\Driver\Command
from skip_if_sleep_command_unavailable()
, and anything else that may use this in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will fix that too.
@@ -5,6 +5,7 @@ ConnectionTimeoutException: exceeding sockettimeoutms | |||
<?php skip_if_not_live(); ?> | |||
<?php skip_if_not_clean(); ?> | |||
<?php skip_if_test_commands_disabled(); ?> | |||
<?php skip_if_sleep_command_unavailable(); ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we already have a skip for disabled test commands on the line above, what is the case where sleep
isn't supported? Unfortunately, it looks like the command is no longer in our own manual, so I've linked to one of the Chinese translations (cloned from an older version).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I wonder if that's related to fail points on mongos not being supported. Depending on the outcome of that ticket, it may make sense to simply skip this test for mongos and leave /* See: SERVER-36066 */
as a comment between the skip function and ?>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The work for skipping this properly (based on the sleep function existing) is already done, so I don't see a reason to remove that again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand skip_if_sleep_command_unavailable()
correctly, it's going to introduce a one-second delay if the server does support the command. If this is also the only place that function would be used, I think the skip is preferable.
I think the best improvement might actually be modifying skip_if_test_commands_disabled()
to also skip if the primary server is a mongos
node, since it doesn't seem to support any test commands (despite reporting otherwise when we query its configuration).
That will also prove more useful down the line if we inevitably add more tests that want to set fail points.
I'm actually curious how the following tests pass on mongos:
tests/standalone/executiontimeoutexception-001.phpt
tests/standalone/executiontimeoutexception-002.phpt
The other two tests that set fail points are currently disabled:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't explain why those two tests actually work, but I checked, and they indeed fail with operation exceeded time limit
, even when talking to mongos
. I can't reproduce this effect in the shell though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also, setting the failpoint on mongos
succeeds:
mongos> db.runCommand( { configureFailPoint: 'maxTimeAlwaysTimeOut', mode: 'alwaysOn' } );
{
"ok" : 1,
"operationTime" : Timestamp(1531733041, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1531733041, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so it is a case of this specific test command not working on mongos. Works for me, then.
tests/apm/overview.phpt
Outdated
["code"]=> | ||
int(26)%A | ||
int(8)%A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that this still reports error code 8 ("UnknownError") instead of 26 ("NamespaceNotFound") is more evidence that geoNear
is not being actively maintained and we should probably avoid using it for any testing.
c.f. https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.err
@@ -12,8 +12,7 @@ | |||
"nssize": 1, | |||
"port": 3000, | |||
"bind_ip_all": true, | |||
"smallfiles": true, | |||
"setParameter": {"enableTestCommands": 1} | |||
"smallfiles": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you removing enableTestCommand
?
I'm curious if this is the reason you needed to introduce skip_if_sleep_command_unavailable()
. Perhaps there's a bug in skip_if_test_commands_disabled()
?
709e29d
to
36ce628
Compare
4a2b3f6
to
b42d739
Compare
- export PATH=${PWD}/mongodb-linux-x86_64-${SERVER_VERSION}/bin/:${PATH} | ||
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-${SERVER_VERSION}.tgz | ||
- tar zxf mongodb-linux-x86_64-ubuntu1404-${SERVER_VERSION}.tgz | ||
- export PATH=${PWD}/mongodb-linux-x86_64-ubuntu1404-${SERVER_VERSION}/bin:${PATH} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there a problem with the standard Linux builds? Is it that they ship without SSL support?
I'm just curious if we might run into issues with the build team no longer supplying 14.04 builds for newer releases down the line (assuming Travis doesn't upgrade to 16.04 sooner).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the standard ones ship without SSL support :-/ And yes, we will run into issues when we stop supporting 14.04 and Travis doesn't upgrade :-/
- ulimit -a | ||
- ulimit -c unlimited || true | ||
- .travis.scripts/before_script.sh | ||
|
||
script: | ||
- export MONGODB_URI=`cat /tmp/uri.txt` | ||
- echo $MONGODB_URI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup_mo.sh
already prints the URI (prefixed with "MongoDB Test URI: "). Why bother doing so again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally, I added the echo here because for some reason the environment variable didn't propagate between steps (i.e., before_script
and script
). I then later added the export
to fix this, and the echo
stayed for testing. I am inclined to keep it.
"nssize": 1, | ||
"port": 3000, | ||
"bind_ip_all": true, | ||
"smallfiles": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per mongodb-labs/mongo-orchestration#247 (comment), I think we can remove nssize
, smallfiles
, and noprealloc
from all of these configs.
Only the STANDALONE_OLD
case under the 3.0.x server version will use MMAPv1 (where noprealloc
might still apply); however, I'm not convinced it's worth optimizing for that case (especially since it's not even a replica set). Having these servers use /tmp
as their DB path should be enough optimization, since I would expect that to be a RAM disk.
I had previously removed noprealloc
from our non-Travis configs in 2ef765a but stupidly added the others in 9a83bde. Perhaps we can remove all three options across the board (for these Travis configs and the non-Travis configs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a ticket for it, to do this as a low priority thing later: https://jira.mongodb.org/browse/PHPC-1240
"procParams": { | ||
"dbpath": "/tmp/REPLICASET/3000/", | ||
"ipv6": true, | ||
"logappend": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this option important given that the Travis build boxes are ephemeral?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was useful for Travis in debug mode.
"ipv6": true, | ||
"logappend": true, | ||
"logpath": "/tmp/REPLICASET/3000/mongod.log", | ||
"journal": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect this was copied over from our non-Travis configs. It looks like storage.journal.enabled
defaults to true only on 64-bit platforms, so it's probably sensible to keep this set explicitly in case.
@@ -0,0 +1,89 @@ | |||
{ | |||
"configsvrs": [ { | |||
"members" : [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These JSON files appear to be using a mix of four-space and tab indents. I'd suggest standardizing on four-space indents, as I did for our non-Travis configs in 8b19fcb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was only this one... → fixed.
@@ -57,7 +57,7 @@ if (isset($document)) { | |||
<?php exit(0); ?> | |||
--EXPECTF-- | |||
Executing command took 0.%d seconds | |||
Rewinding cursor took 1.%d seconds | |||
Rewinding cursor took 0.%r(4|5)%r%d seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. 👍
tests/connect/bug1045.phpt
Outdated
@@ -12,7 +12,7 @@ PHPC-1045: Segfault if username is not provided for SCRAM-SHA-1 authMechanism | |||
require_once __DIR__ . "/../utils/basic.inc"; | |||
|
|||
// URI does not support auth, but that is not necessary for the test | |||
$m = new MongoDB\Driver\Manager(URI, ['authMechanism' => 'SCRAM-SHA-1', 'ssl' => false]); | |||
$m = new MongoDB\Driver\Manager(URI, ['authMechanism' => 'SCRAM-SHA-1']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the "URI does not support auth" comment above still relevant, given that we may be testing against a server using authentication?
Perhaps this should be changed to: "URI may or may not support auth, but that..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
@@ -5,6 +5,7 @@ ConnectionTimeoutException: exceeding sockettimeoutms | |||
<?php skip_if_not_live(); ?> | |||
<?php skip_if_not_clean(); ?> | |||
<?php skip_if_test_commands_disabled(); ?> | |||
<?php skip_if_sleep_command_unavailable(); ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand skip_if_sleep_command_unavailable()
correctly, it's going to introduce a one-second delay if the server does support the command. If this is also the only place that function would be used, I think the skip is preferable.
I think the best improvement might actually be modifying skip_if_test_commands_disabled()
to also skip if the primary server is a mongos
node, since it doesn't seem to support any test commands (despite reporting otherwise when we query its configuration).
That will also prove more useful down the line if we inevitably add more tests that want to set fail points.
I'm actually curious how the following tests pass on mongos:
tests/standalone/executiontimeoutexception-001.phpt
tests/standalone/executiontimeoutexception-002.phpt
The other two tests that set fail points are currently disabled:
b42d739
to
7ae04b2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, although there still appear to be two build failures in https://travis-ci.org/mongodb/mongo-php-driver/builds/404364466.
No description provided.