Skip to content

PHPC-1173: Reimplement replica set seedlist tests #906

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

Merged
merged 3 commits into from
Aug 10, 2018

Conversation

derickr
Copy link
Contributor

@derickr derickr commented Aug 8, 2018

No description provided.

@derickr derickr requested a review from jmikola August 8, 2018 11:18
@@ -39,6 +39,20 @@ function skip_if_not_replica_set()
is_replica_set(URI) or exit('skip topology is not a replica set');
}

/**
* Skips the test if the topology is not a replica set.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should be updated to refer to an arbiter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

function skip_if_no_arbiter()
{
is_replica_set(URI) or exit('skip topology is not a replica set');
$primary = get_primary_server(URI);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should follow the model in skip_if_not_live() with a try/catch for ConnectionException. That way, it's not relying on our global exception handler to emit a "skip" message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The is_replica_set call shouldn't have been here. And the test(s) that use skip_if_no_arbiter already check the skip_if_not_replica_set first too.

As a matter of fact, is_replica_set/skip_if_replica_set don't do the try/catch either…

So although I can wrap the 48 line in a try-catch, I am not sure what it actually improves.

--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";

$secondary = get_secondary_server(URI);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this calls for a skip_if_no_secondary() function in the SKIPIF, as this could easily fail against a replica set with a single primary node.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, but we don't have such an (automated) set-up in Travis. Should we add one?

Copy link
Member

@jmikola jmikola Aug 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine without if you'd like to test this locally. It's something we should certainly intend to test on Evergreen, but we should be fairly conservative in our use of Travis' resources :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added one anyway...


$dsn = "mongodb://192.168.112.10:3001/?replicaSet=REPLICASET";
$manager = new MongoDB\Driver\Manager($dsn);
$dsn = 'mongodb://' . $info['me'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clever :)

@derickr derickr force-pushed the PHPC-1173-replica-set-seedlist-tests branch 2 times, most recently from c87b5c0 to 70f8f24 Compare August 8, 2018 17:46
try {
$primary = get_primary_server(URI);
} catch (ConnectionException $e) {
exit('skip server is not accessible: ' . $e->getMessage());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this message also say "primary server" for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix before merging.

Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comments but LGTM.

@derickr derickr force-pushed the PHPC-1173-replica-set-seedlist-tests branch from 70f8f24 to 7d1ac7b Compare August 10, 2018 10:26
@derickr derickr merged commit 7d1ac7b into mongodb:master Aug 10, 2018
derickr added a commit that referenced this pull request Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants