Skip to content
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

DM-42138: Add test for get_dataset collection caching #934

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/test_butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,17 @@ def testButlerRewriteDataId(self) -> None:
new_metric = butler.get(datasetTypeName, dataId=dataId)
self.assertEqual(new_metric, metric)

def testGetDatasetCollectionCaching(self):
# Prior to DM-41117, there was a bug where get_dataset would throw
# MissingCollectionError if you tried to fetch a dataset that was added
# after the collection cache was last updated.
reader_butler, datasetType = self.create_butler(self.default_run, "int", "datasettypename")
writer_butler = Butler.from_config(self.tmpConfigFile, writeable=True, run="new_run")
dataId = {"instrument": "DummyCamComp", "visit": 423}
put_ref = writer_butler.put(123, datasetType, dataId)
get_ref = reader_butler.get_dataset(put_ref.id)
self.assertEqual(get_ref.id, put_ref.id)


class FileDatastoreButlerTests(ButlerTests):
"""Common tests and specialization of ButlerTests for butlers backed
Expand Down