Skip to content

Test fixes for libmongoc 1.9.0-dev (post rc1) #701

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 7 commits into from
Dec 12, 2017

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Dec 12, 2017

@jmikola jmikola requested a review from derickr December 12, 2017 05:08
@@ -28,10 +28,10 @@ echo throws(function() use ($bulk) {
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
update document contains invalid key: empty key
invalid selector for update: empty key
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: this expected output will need to be changed again once mongodb/mongo-c-driver#472 is merged.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we care enough about the exact word? I'd be happy if we just just %s for the word "selector"/"argument".

Copy link
Member Author

Choose a reason for hiding this comment

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

I personally don't care, but without this test we wouldn't have caught the mistake in libmongoc. I don't think libmongoc is going to add tests for all of its error messages, so I'm OK with keeping this around.

@@ -0,0 +1,48 @@
--TEST--
MongoDB\Driver\Manager::executeCommand() options
Copy link
Member Author

Choose a reason for hiding this comment

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

This file was renamed from manager-executeRawCommand-001.phpt

Copy link
Contributor

Choose a reason for hiding this comment

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

I had specifically named this to match that PR's changes - where we have Raw, Read, Write, and ReadWrite, so I am not sure if this a good idea.

Copy link
Member Author

Choose a reason for hiding this comment

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

Was this the only occurrence of "Raw" from that PR? I gathered it was more confusing to have a test named in the class-method for a method that doesn't exist.

We both know that executeCommand() implies MONGO_CMD_RAW. Would adding "Raw Command" (or similar) to the test title be a fair compromise?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just noticed that manager-executeCommand_error-002.phpt was added in the same PR and didn't use the "RawCommand" name.

<?php exit(0); ?>
--EXPECTF--
Read Preference: secondary
Read Concern: local
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: this test currently fails because CDRIVER-2418 now ignores the readConcern option unless the read flag is set for the command (not done for the raw and write modes). This should be fixed by CDRIVER-2422.

public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
{
}
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed that some of the newer executeCommand() tests were using tabs instead of spaces. A text search turned up many more occurrences, so I've fixed them all in a single commit within this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a pointless change. And would rather have seen that in a specific PR, as now it's more difficult to review this as I have to go through all of it.

Copy link
Contributor

@derickr derickr left a comment

Choose a reason for hiding this comment

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

LGTM, but left some comments that you might want to look at.

public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
{
}
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a pointless change. And would rather have seen that in a specific PR, as now it's more difficult to review this as I have to go through all of it.

@@ -28,10 +28,10 @@ echo throws(function() use ($bulk) {
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
update document contains invalid key: empty key
invalid selector for update: empty key
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we care enough about the exact word? I'd be happy if we just just %s for the word "selector"/"argument".

@@ -0,0 +1,48 @@
--TEST--
MongoDB\Driver\Manager::executeCommand() options
Copy link
Contributor

Choose a reason for hiding this comment

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

I had specifically named this to match that PR's changes - where we have Raw, Read, Write, and ReadWrite, so I am not sure if this a good idea.

@jmikola jmikola force-pushed the libmongoc-1.9-test-fixes branch 2 times, most recently from 8c08b5f to 15771c4 Compare December 12, 2017 13:37
Copy link
Contributor

@derickr derickr left a comment

Choose a reason for hiding this comment

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

LGTM

jmikola added a commit that referenced this pull request Dec 12, 2017
@jmikola jmikola force-pushed the libmongoc-1.9-test-fixes branch 2 times, most recently from 6109d13 to 464265e Compare December 12, 2017 14:53
As of mongodb/mongo-c-driver@c2639c8, libmongoc no longer adds a default write concern to commands.
This serves as a reminder that executeCommand() is the execution method for raw commands.
This test is adapted from manager-executeCommand-004.phpt.
@jmikola jmikola force-pushed the libmongoc-1.9-test-fixes branch from 464265e to 154ca93 Compare December 12, 2017 20:27
@jmikola jmikola merged commit 154ca93 into mongodb:master Dec 12, 2017
jmikola added a commit that referenced this pull request Dec 12, 2017
@jmikola jmikola deleted the libmongoc-1.9-test-fixes branch December 12, 2017 20:28
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