Skip to content

Add collection $drop tests#129

Open
danielfrankcom wants to merge 2 commits intodocumentdb:mainfrom
danielfrankcom:pr/collection-drop
Open

Add collection $drop tests#129
danielfrankcom wants to merge 2 commits intodocumentdb:mainfrom
danielfrankcom:pr/collection-drop

Conversation

@danielfrankcom
Copy link
Copy Markdown
Collaborator

This change adds tests for the $drop operator.

It introduces a new CommandTestCase class which is intended to be shared by all collection command tests. The big difference from existing classes like ExpressionTestCase is that collection command tests tend to need fixture data as part of the test case. To resolve this I've provided the ability to use a Callable to get information about the fixtures while defining the test case. Similar to StageTestCase, a setup hook is also provided to configure prerequisites like specifically named collections.

I also had to modify assertResult to allow raw_res to be punched through to assertSuccess.

Signed-off-by: Daniel Frankcom <frankcom@amazon.com>
@danielfrankcom danielfrankcom requested a review from a team as a code owner April 22, 2026 16:47
Signed-off-by: Daniel Frankcom <frankcom@amazon.com>
),
CommandTestCase(
"ttl",
setup=lambda db: (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All 6 test functions have an identical 9-line body (setup → insert → ctx → execute → assert). can we Extract to a shared run_command_test(database_client, collection, test) helper in commands/utils/ to reduce duplication.

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