Skip to content

PYTHON-3014 Update how events are added to entity map to match specification #785

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
Nov 13, 2021

Conversation

juliusgeo
Copy link
Contributor

No description provided.

@@ -226,7 +226,10 @@ def add_event(self, event):
if event_name in self._event_types:
super(EventListenerUtil, self).add_event(event)
for id in self._event_mapping[event_name]:
self.entity_map[id].append(str(event))
self.entity_map[id].append({
"name": type(event).__name__,
Copy link
Member

Choose a reason for hiding this comment

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

repr(event) is better than just the type name because it includes the event name and other additional info (see the __repr__ methods in monitoring.py).

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 originally had it just use str(event). However,

 if ('name' not in event) or (not event['name'].endswith('Event')):
                    self.fail("The workload executor didn't record event name as expected.")

This line from validator.py in drivers-atlas-testing seems to indicate that it expects it to just have the name, and no additional information

Copy link
Member

Choose a reason for hiding this comment

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

Okay, in that case can we add a new field for the full event repr?

Copy link
Contributor Author

@juliusgeo juliusgeo Nov 12, 2021

Choose a reason for hiding this comment

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

Done.

@ShaneHarvey
Copy link
Member

ShaneHarvey commented Nov 12, 2021

Please fix these issues as well:

 [2021/11/12 18:48:48.578]   Topology <Topology <TopologyDescription id: 618eb62b2a3248eb7baee2cf, topology_type: Single, servers: [<ServerDescription ('localhost', 27017) server_type: Standalone, rtt: 0.0016251377895071756>]>> has THREADS RUNNING: [<PeriodicExecutor(name=pymongo_server_monitor_thread) object at 0x7f63b2e336d8>, <PeriodicExecutor(name=pymongo_server_rtt_thread) object at 0x7f63b2e338d0>], created at:   File "setup.py", line 347, in <module>
 [2021/11/12 18:48:48.578]     **extra_opts
 [2021/11/12 18:48:48.578]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/venv-encryption/lib64/python3.6/dist-packages/setuptools/__init__.py", line 159, in setup
 [2021/11/12 18:48:48.578]     return distutils.core.setup(**attrs)
 [2021/11/12 18:48:48.578]   File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
 [2021/11/12 18:48:48.578]     dist.run_commands()
 [2021/11/12 18:48:48.578]   File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
 [2021/11/12 18:48:48.578]     self.run_command(cmd)
 [2021/11/12 18:48:48.578]   File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
 [2021/11/12 18:48:48.578]     cmd_obj.run()
 [2021/11/12 18:48:48.578]   File "setup.py", line 127, in run
 [2021/11/12 18:48:48.578]     result = runner.run(suite)
 [2021/11/12 18:48:48.578]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/__init__.py", line 1070, in run
 [2021/11/12 18:48:48.578]     result = super(PymongoTestRunner, self).run(test)
 [2021/11/12 18:48:48.578]   File "/usr/lib64/python3.6/unittest/runner.py", line 176, in run
 [2021/11/12 18:48:48.578]     test(result)
 [2021/11/12 18:48:48.578]   File "/usr/lib64/python3.6/unittest/suite.py", line 84, in __call__
 [2021/11/12 18:48:48.578]     return self.run(*args, **kwds)
 [2021/11/12 18:48:48.578]   File "/usr/lib64/python3.6/unittest/suite.py", line 122, in run
 [2021/11/12 18:48:48.578]     test(result)
 [2021/11/12 18:48:48.578]   File "/usr/lib64/python3.6/unittest/case.py", line 670, in __call__
 [2021/11/12 18:48:48.578]     return self.run(*args, **kwds)
 [2021/11/12 18:48:48.578]   File "/usr/lib64/python3.6/unittest/case.py", line 622, in run
 [2021/11/12 18:48:48.578]     testMethod()
 [2021/11/12 18:48:48.578]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/test_create_entities.py", line 134, in test_store_all_others_as_entities
 [2021/11/12 18:48:48.578]     self.scenario_runner.run_scenario(spec["tests"][0])
 [2021/11/12 18:48:48.578]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/unified_format.py", line 1194, in run_scenario
 [2021/11/12 18:48:48.578]     self.TEST_SPEC.get('createEntities', []))
 [2021/11/12 18:48:48.578]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/unified_format.py", line 371, in create_entities_from_spec
 [2021/11/12 18:48:48.578]     self._create_entity(spec)
 [2021/11/12 18:48:48.578]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/unified_format.py", line 318, in _create_entity
 [2021/11/12 18:48:48.578]     client = rs_or_single_client(**kwargs)
 [2021/11/12 18:48:48.578]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/utils.py", line 576, in rs_or_single_client
 [2021/11/12 18:48:48.578]     return _mongo_client(h, p, **kwargs)
 [2021/11/12 18:48:48.578]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/utils.py", line 539, in _mongo_client
 [2021/11/12 18:48:48.578]     return MongoClient(uri, port, **client_options)
 [2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/pymongo/mongo_client.py", line 751, in __init__
 [2021/11/12 18:48:48.579]     srv_max_hosts=srv_max_hosts
 [2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/pymongo/settings.py", line 74, in __init__
 [2021/11/12 18:48:48.579]     self._stack = ''.join(traceback.format_stack())
[2021/11/12 18:48:48.579]   Topology <Topology <TopologyDescription id: 618eb62b2a3248eb7baee2d0, topology_type: Single, servers: [<ServerDescription ('localhost', 27017) server_type: Standalone, rtt: 0.002375924643324942>]>> has THREADS RUNNING: [<PeriodicExecutor(name=pymongo_server_monitor_thread) object at 0x7f63b2e6c5f8>, <PeriodicExecutor(name=pymongo_server_rtt_thread) object at 0x7f63b2e6c748>], created at:   File "setup.py", line 347, in <module>
[2021/11/12 18:48:48.579]     **extra_opts
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/venv-encryption/lib64/python3.6/dist-packages/setuptools/__init__.py", line 159, in setup
[2021/11/12 18:48:48.579]     return distutils.core.setup(**attrs)
[2021/11/12 18:48:48.579]   File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
[2021/11/12 18:48:48.579]     dist.run_commands()
[2021/11/12 18:48:48.579]   File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
[2021/11/12 18:48:48.579]     self.run_command(cmd)
[2021/11/12 18:48:48.579]   File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
[2021/11/12 18:48:48.579]     cmd_obj.run()
[2021/11/12 18:48:48.579]   File "setup.py", line 127, in run
[2021/11/12 18:48:48.579]     result = runner.run(suite)
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/__init__.py", line 1070, in run
[2021/11/12 18:48:48.579]     result = super(PymongoTestRunner, self).run(test)
[2021/11/12 18:48:48.579]   File "/usr/lib64/python3.6/unittest/runner.py", line 176, in run
[2021/11/12 18:48:48.579]     test(result)
[2021/11/12 18:48:48.579]   File "/usr/lib64/python3.6/unittest/suite.py", line 84, in __call__
[2021/11/12 18:48:48.579]     return self.run(*args, **kwds)
[2021/11/12 18:48:48.579]   File "/usr/lib64/python3.6/unittest/suite.py", line 122, in run
[2021/11/12 18:48:48.579]     test(result)
[2021/11/12 18:48:48.579]   File "/usr/lib64/python3.6/unittest/case.py", line 670, in __call__
[2021/11/12 18:48:48.579]     return self.run(*args, **kwds)
[2021/11/12 18:48:48.579]   File "/usr/lib64/python3.6/unittest/case.py", line 622, in run
[2021/11/12 18:48:48.579]     testMethod()
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/test_create_entities.py", line 51, in test_store_events_as_entities
[2021/11/12 18:48:48.579]     self.scenario_runner.run_scenario(spec["tests"][0])
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/unified_format.py", line 1194, in run_scenario
[2021/11/12 18:48:48.579]     self.TEST_SPEC.get('createEntities', []))
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/unified_format.py", line 371, in create_entities_from_spec
[2021/11/12 18:48:48.579]     self._create_entity(spec)
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/unified_format.py", line 318, in _create_entity
[2021/11/12 18:48:48.579]     client = rs_or_single_client(**kwargs)
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/utils.py", line 576, in rs_or_single_client
[2021/11/12 18:48:48.579]     return _mongo_client(h, p, **kwargs)
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/test/utils.py", line 539, in _mongo_client
[2021/11/12 18:48:48.579]     return MongoClient(uri, port, **client_options)
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/pymongo/mongo_client.py", line 751, in __init__
[2021/11/12 18:48:48.579]     srv_max_hosts=srv_max_hosts
[2021/11/12 18:48:48.579]   File "/data/mci/9761f08bdab22b20d464975a801a1bc9/src/pymongo/settings.py", line 74, in __init__
[2021/11/12 18:48:48.579]     self._stack = ''.join(traceback.format_stack())

test_create_entities is opening clients and never closes them.

@juliusgeo juliusgeo merged commit 6d1dd6d into mongodb:master Nov 13, 2021
juliusgeo added a commit to juliusgeo/mongo-python-driver that referenced this pull request Apr 5, 2022
juliusgeo added a commit to juliusgeo/mongo-python-driver that referenced this pull request Apr 7, 2022
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