-
Notifications
You must be signed in to change notification settings - Fork 8
Run tests on MongoDB v5.0.23 instead of v3.2.19 #49
Conversation
|
Summary of test failures:
More detailed test failures``` ============================= test session starts ============================== platform linux -- Python 3.10.1, pytest-8.3.4, pluggy-1.5.0 rootdir: /home/circleci/code collected 490 itemstests/document/test_class_methods.py ........... [ 2%] =================================== FAILURES =================================== self = <tests.document.test_instance.InstanceTest testMethod=test_reload_sharded>
E KeyError: 'query' tests/document/test_instance.py:386: KeyError self = <tests.document.test_instance.InstanceTest testMethod=test_update_shard_key_routing>
E KeyError: 'query' tests/document/test_instance.py:410: KeyError self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_exec_js_field_sub>
tests/queryset/test_queryset.py:1132: mongoengine/queryset/queryset.py:1170: in exec_js response = {'code': 59, 'codeName': 'CommandNotFound', 'errmsg': "no such command: '$eval'", 'ok': 0.0}
E pymongo.errors.OperationFailure: no such command: '$eval', full error: {'ok': 0.0, 'errmsg': "no such command: '$eval'", 'code': 59, 'codeName': 'CommandNotFound'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_exec_js_query>
tests/queryset/test_queryset.py:1081: mongoengine/queryset/queryset.py:1170: in exec_js response = {'code': 59, 'codeName': 'CommandNotFound', 'errmsg': "no such command: '$eval'", 'ok': 0.0}
E pymongo.errors.OperationFailure: no such command: '$eval', full error: {'ok': 0.0, 'errmsg': "no such command: '$eval'", 'code': 59, 'codeName': 'CommandNotFound'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_item_frequencies>
tests/queryset/test_queryset.py:1951: mongoengine/queryset/queryset.py:1238: in item_frequencies response = {'code': 2, 'codeName': 'BadValue', 'errmsg': "'map' must be of string or code type", 'ok': 0.0}
E pymongo.errors.OperationFailure: 'map' must be of string or code type, full error: {'ok': 0.0, 'errmsg': "'map' must be of string or code type", 'code': 2, 'codeName': 'BadValue'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_item_frequencies_normalize>
tests/queryset/test_queryset.py:2140: mongoengine/queryset/queryset.py:1240: in item_frequencies response = {'code': 59, 'codeName': 'CommandNotFound', 'errmsg': "no such command: '$eval'", 'ok': 0.0}
E pymongo.errors.OperationFailure: no such command: '$eval', full error: {'ok': 0.0, 'errmsg': "no such command: '$eval'", 'code': 59, 'codeName': 'CommandNotFound'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_item_frequencies_null_values>
tests/queryset/test_queryset.py:2062: mongoengine/queryset/queryset.py:1238: in item_frequencies response = {'code': 2, 'codeName': 'BadValue', 'errmsg': "'map' must be of string or code type", 'ok': 0.0}
E pymongo.errors.OperationFailure: 'map' must be of string or code type, full error: {'ok': 0.0, 'errmsg': "'map' must be of string or code type", 'code': 2, 'codeName': 'BadValue'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_item_frequencies_on_embedded>
tests/queryset/test_queryset.py:2025: mongoengine/queryset/queryset.py:1238: in item_frequencies response = {'code': 2, 'codeName': 'BadValue', 'errmsg': "'map' must be of string or code type", 'ok': 0.0}
E pymongo.errors.OperationFailure: 'map' must be of string or code type, full error: {'ok': 0.0, 'errmsg': "'map' must be of string or code type", 'code': 2, 'codeName': 'BadValue'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_item_frequencies_with_0_values>
tests/queryset/test_queryset.py:2109: mongoengine/queryset/queryset.py:1238: in item_frequencies response = {'code': 2, 'codeName': 'BadValue', 'errmsg': "'map' must be of string or code type", 'ok': 0.0}
E pymongo.errors.OperationFailure: 'map' must be of string or code type, full error: {'ok': 0.0, 'errmsg': "'map' must be of string or code type", 'code': 2, 'codeName': 'BadValue'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_item_frequencies_with_False_values>
tests/queryset/test_queryset.py:2123: mongoengine/queryset/queryset.py:1238: in item_frequencies response = {'code': 2, 'codeName': 'BadValue', 'errmsg': "'map' must be of string or code type", 'ok': 0.0}
E pymongo.errors.OperationFailure: 'map' must be of string or code type, full error: {'ok': 0.0, 'errmsg': "'map' must be of string or code type", 'code': 2, 'codeName': 'BadValue'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_item_frequencies_with_null_embedded>
tests/queryset/test_queryset.py:2094: mongoengine/queryset/queryset.py:1240: in item_frequencies response = {'code': 59, 'codeName': 'CommandNotFound', 'errmsg': "no such command: '$eval'", 'ok': 0.0}
E pymongo.errors.OperationFailure: no such command: '$eval', full error: {'ok': 0.0, 'errmsg': "no such command: '$eval'", 'code': 59, 'codeName': 'CommandNotFound'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_map_reduce>
tests/queryset/test_queryset.py:1758: mongoengine/queryset/queryset.py:1115: in map_reduce response = {'code': 2, 'codeName': 'BadValue', 'errmsg': "'map' must be of string or code type", 'ok': 0.0}
E pymongo.errors.OperationFailure: 'map' must be of string or code type, full error: {'ok': 0.0, 'errmsg': "'map' must be of string or code type", 'code': 2, 'codeName': 'BadValue'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_map_reduce_finalize>
tests/queryset/test_queryset.py:1920: mongoengine/queryset/queryset.py:1115: in map_reduce response = {'code': 2, 'codeName': 'BadValue', 'errmsg': "'map' must be of string or code type", 'ok': 0.0}
E pymongo.errors.OperationFailure: 'map' must be of string or code type, full error: {'ok': 0.0, 'errmsg': "'map' must be of string or code type", 'code': 2, 'codeName': 'BadValue'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_map_reduce_with_custom_object_ids>
tests/queryset/test_queryset.py:1807: mongoengine/queryset/queryset.py:1115: in map_reduce response = {'code': 2, 'codeName': 'BadValue', 'errmsg': "'map' must be of string or code type", 'ok': 0.0}
E pymongo.errors.OperationFailure: 'map' must be of string or code type, full error: {'ok': 0.0, 'errmsg': "'map' must be of string or code type", 'code': 2, 'codeName': 'BadValue'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:167: OperationFailure self = [<BlogPost: BlogPost object>], upsert = False, multi = False
mongoengine/queryset/queryset.py:527: ../.local/lib/python3.10/site-packages/pymongo/collection.py:1028: in update_one write_errors = [{'code': 9, 'errmsg': 'Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array', 'index': 0}]
E pymongo.errors.WriteError: Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array, full error: {'index': 0, 'code': 9, 'errmsg': 'Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:211: WriteError During handling of the above exception, another exception occurred: self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_update>
tests/queryset/test_queryset.py:1403: mongoengine/queryset/queryset.py:552: in update_one self = [<BlogPost: BlogPost object>], upsert = False, multi = False
E mongoengine.errors.OperationError: Update failed (Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array, full error: {'index': 0, 'code': 9, 'errmsg': 'Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array'}) mongoengine/queryset/queryset.py:536: OperationError self = [<BlogPost: BlogPost object>], upsert = False, multi = True
mongoengine/queryset/queryset.py:527: ../.local/lib/python3.10/site-packages/pymongo/collection.py:1104: in update_many write_errors = [{'code': 9, 'errmsg': 'Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array', 'index': 0}]
E pymongo.errors.WriteError: Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array, full error: {'index': 0, 'code': 9, 'errmsg': 'Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array'} ../.local/lib/python3.10/site-packages/pymongo/helpers.py:211: WriteError During handling of the above exception, another exception occurred: self = <tests.queryset.test_queryset.QuerySetTest testMethod=test_update_push_and_pull_add_to_set>
tests/queryset/test_queryset.py:1440: self = [<BlogPost: BlogPost object>], upsert = False, multi = True
E mongoengine.errors.OperationError: Update failed (Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array, full error: {'index': 0, 'code': 9, 'errmsg': 'Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array'}) mongoengine/queryset/queryset.py:536: OperationError |
This is an obscure piece of functionality that's hasn't been working for quite some time and is not needed for us going forward. The only remaining references to `item_frequencies` are in the old upgrade doc and in a changelog that's unmaintained in this repo: ``` (vevn) wojcikstefan@stefans-mbp mongoengine % rg item_frequencies docs/changelog.rst 233:- Added support for null / zero / false values in item_frequencies 432:- Updated item_frequencies to handle embedded document lookups 443:- Added map_reduce method item_frequencies and set as default (as db.eval doesn't work in sharded environments) 464:- Fixed item_frequencies when using name thats the same as a native js function docs/upgrade.rst 388:item_frequencies 392:item_frequencies. A side effect was to return keys in the value they are 449: * :meth:`~mongoengine.queryset.QuerySet.item_frequencies` ```
05b39f9 to
34ca448
Compare
|
Removed |
This is an obscure piece of functionality that's hasn't been working for quite some time and is not needed for us going forward. The only remaining references to `map_reduce` are in the old upgrade doc and in a changelog that's unmaintained in this repo: ``` (vevn) wojcikstefan@stefans-mbp mongoengine % rg map_reduce docs/changelog.rst 418:- Updated sum / average to use map_reduce as db.eval doesn't work in sharded environments 443:- Added map_reduce method item_frequencies and set as default (as db.eval doesn't work in sharded environments) 444:- Added inline_map_reduce option to map_reduce 459: map_reduce now requires an output. docs/upgrade.rst 428:main areas of changed are: choices in fields, map_reduce and collection names. 444:More methods now use map_reduce as db.eval is not supported for sharding as ```
|
Removed |
These weren't really working well already and we don't need them. It's also dangerous to run arbitrary and possibly unvalidated / unsanitized JS code from Python. The only remaining mention of `exec_js` is in the unmaintained changelog: ``` (vevn) wojcikstefan@stefans-mbp mongoengine % rg exec_js docs/changelog.rst 535:- Fixed bug where ``QuerySet.exec_js`` ignored ``Q`` objects ```
|
Removed |
This operator has been deprecated since MongoDB v2.4 and has been removed from subsequent versions.
bee31f5 to
5234645
Compare
|
Removed the I had to manually download the super old v3.2 docs to confirm that this operator even existed and has been deprecated: Down to 2 failures: |
aea332b to
701c6db
Compare
|
Ok, last 2 tests needed fixing because the shape of the documents in MongoDB's profile collection has changed. All good now. |

The test suite currently fails for this version of MongoDB even though this version of MongoEngine is confirmed to run well with it. Need to look into the failures more closely before shipping this.