-
Notifications
You must be signed in to change notification settings - Fork 1.1k
ENH: add helper method to run tests on specific storage engines #356
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
ENH: add helper method to run tests on specific storage engines #356
Conversation
22e6bee to
bd8ec69
Compare
test/__init__.py
Outdated
|
|
||
| # May not have this if OperationFailure was raised earlier. | ||
| self.cmd_line = self.client.admin.command('getCmdLineOpts') | ||
| self.server_status = self.client.admin.command('serverStatus') |
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.
You only need to run serverStatus once after creating the authenticated client. Just un-indent this line and remove the serverStatus on line 229.
test/__init__.py
Outdated
| """Run a test only if the server is running the specified storage | ||
| engine (as determined by the `db.serverStatus` command).""" | ||
| #server_status = self.client.admin.command("serverStatus") | ||
| #current_engine = server_status["storageEngine"]["name"] |
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.
Remove comments.
test/__init__.py
Outdated
| #server_status = self.client.admin.command("serverStatus") | ||
| #current_engine = server_status["storageEngine"]["name"] | ||
| return self._require( | ||
| lambda: engine == self.server_status["storageEngine"]["name"], |
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.
This will fail when self.server_status is None. What if we just keep track of the storage engine instead of the entire server status response?
test/test_change_stream.py
Outdated
|
|
||
| @classmethod | ||
| @client_context.require_version_min(4, 0, 0, -1) | ||
| @client_context.require_storage_engine("wiredTiger") |
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.
Change streams work of storage engines other than wiredTiger. Like inMemory for example. Can you make these @client_context.require_not_mmap instead?
|
Ignoring your comments for now as this will need a rethink since it cannot presently work with a sharded cluster. |
For now we don't need it to work on a sharded cluster. All we need is to skip the spec tests when connected to a standalone server running with MMAP. |
|
Thanks! |
Closes PYTHON-1597
This allows us to specify (with the help of a decorator on the
ClientContext) the storage engine that the server must be running with for a given test to be executed.Motivation
Spec-tests introduced in PYTHON-1565 can only be run when the server is using wired Tiger. These tests failed when the MMAPv1 engine was in use, resulting in failures on evergreen.
Comments
I chose to use the
db.serverStatus()command to obtain storage engine information because:serverStatusseemed to present fewer ambiguities than the output ofgetCmdLineOpts. The latter tends to be confusing because thegetCmdLineOpts['parsed']dict seems to always contain thewiredTigerkey and we need to check whether theenginekey has been set tommapv1to ascertain the storage engine. This seemed a bit counter-intuitive to me but if you're not a fan of callingserverStatus, I can use thecmd_lineinformation as well.