-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Fix test flakiness mentioned in #1716 and seen after. The problem was subtle: - There are three places Collection state is stored: in Hypothesis's Bundle (== test data ~randomly generated according to our models), in our test's `.model` field, and in Chroma itself. - Each test step gets a random Collection from the Bundle. Our test code is responsible for doing stuff with it, modifying the test model, executing operations on Chroma itself, and verifying that model state matches Chroma's state. - Hypothesis's Bundle has (but no longer will once this PR lands) a full Collection model with all internal bookeeping, incl UUID and other fields. So we could have two Collections in the Bundle with the same name but different UUIDs or other fields. In our test's model and in Chroma, there would only be one Collection. - The bug arose when we updated metadata on one Bundle collection, on our model, and in Chroma; then tried to read metadata from another Bundle collection with the same name but different metadata. The fix to this was to read expected collection metadata from our test model, not from the Bundle. I changed line 204 to `_metadata = self.model[coll.name]` instead of `_metadata = coll.metadata`. - To save people others this grief in the future, I created a new `ExternalCollection` model which only contains externally visible Collection data. This simplifies Bundle state for this test and should make it easier to reason about in the future. - I also added the previously failing test cases to protect us from regressions. Since the model is much simpler now they don't give us much, but I feel better knowing they're there and laying the pattern for us to add future test cases. ## Test plan *How are these changes tested?* - [x] Tests pass locally with `pytest` for python, `yarn test` for js ## Documentation Changes *Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs repository](https://github.com/chroma-core/docs)?*
- Loading branch information
Showing
2 changed files
with
122 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters