Skip to content

Conversation

@eculver
Copy link
Contributor

@eculver eculver commented Jun 22, 2025

Note for reviewers

Sorry in advance for extra diff noise. I realized that the tests here are harder to work with than they should be (which is probably why we have so many gaps in the tests) so I refactored some things to move the needle in the right direction. I will follow up with more testing changes.

Summary

This adds a test for the CheckCollections method. This would have caught the issue fixed in #4899.

Along the way, I discovered how these tests need some love, so I started down this path by introducing a new daotest package that provides testing helpers for creating Collection values that are easier to configure. Instead of having to potentially debug all the tests that use dao.CreateTestCollection, I defined a "shim" that can be used as a stop-gap so that I can change the signature of this dao.CreateTestCollection without potentially derailing the original goal which was just to add some missing test coverage.

  • Improvements & Bug fixes
    • Added test coverage for CheckCollections service endpoint
  • New functionality
    • Added daotest package and NewTestCollection helper with builder/options methods for more configurability

Test plan

All the tests are passing.

Documentation Changes

N/A

@eculver eculver marked this pull request as ready for review June 22, 2025 05:43
@github-actions
Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@propel-code-bot
Copy link
Contributor

Add CheckCollections Test and Refactor Test Collection Setup Helpers

This PR adds explicit test coverage for the CheckCollections gRPC method, which would have caught a previously resolved bug (#4899). To enable more flexible and maintainable test setup, it introduces a new daotest package with configurable test collection builders, refactors test helpers to take dbmodel.Collection objects instead of parameter lists, and updates all affected test code and utilities to use the new helpers. No production code is affected; all changes are limited to test code and test utility infrastructure.

Key Changes:
• Added a comprehensive test for the CheckCollections endpoint in collection_service_test.go.
• Introduced go/pkg/sysdb/metastore/db/dao/daotest/collection.go with NewTestCollection and builder-style option helpers.
• Replaced all direct calls to CreateTestCollection with the new daotest.NewDefaultTestCollection or NewTestCollection helper throughout integration and unit test files.
• Refactored CreateTestCollection to accept a dbmodel.Collection struct rather than many parameters, improving flexibility for future test coverage.
• Cleaned up test utilities and clarified TODOs for follow-up refactoring.

Affected Areas:
• Testing utilities for collection creation (dao/test_utils.go, dao/daotest/collection.go)
• Collection-related integration and unit tests in sysdb/grpc, dao, and segment tests

This summary was automatically generated by @propel-code-bot

@eculver eculver mentioned this pull request Jun 22, 2025
1 task
@eculver
Copy link
Contributor Author

eculver commented Jun 25, 2025

I gave folks all week to review. No one did, or maybe they did and didn't leave feedback. Either way, I've asked many times so I'm just going to merge.

@eculver eculver merged commit 1784fc9 into main Jun 25, 2025
58 checks passed
Inventrohyder pushed a commit to Inventrohyder/chroma that referenced this pull request Aug 5, 2025
… flexible (chroma-core#4912)

## Summary
This adds a test for the `CheckCollections` method. This would have
caught the issue fixed in chroma-core#4899.

Along the way, I discovered how these tests need some love, so I started
down this path by introducing a new `daotest` package that provides
testing helpers for creating `Collection` values that are easier to
configure. Instead of having to potentially debug all the tests that use
`dao.CreateTestCollection`, I defined a "shim" that can be used as a
stop-gap so that I can change the signature of this
`dao.CreateTestCollection` without potentially derailing the original
goal which was just to add some missing test coverage.

- Improvements & Bug fixes
  - Added test coverage for `CheckCollections` service endpoint
- New functionality
- Added `daotest` package and `NewTestCollection` helper with
builder/options methods for more configurability

## Test plan

All the tests are passing.

## Documentation Changes

N/A
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