Skip to content

Commit

Permalink
Merge pull request #934 from lsst/tickets/DM-42138
Browse files Browse the repository at this point in the history
DM-42138: Add test for get_dataset collection caching
  • Loading branch information
dhirving authored Jan 3, 2024
2 parents 1946ade + b6dd0c5 commit ae0d0ea
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit ae0d0ea

Please sign in to comment.