Skip to content

Add $abortTransaction command tests#600

Open
alinaliBQ wants to merge 3 commits into
documentdb:mainfrom
alinaliBQ:abortTransaction
Open

Add $abortTransaction command tests#600
alinaliBQ wants to merge 3 commits into
documentdb:mainfrom
alinaliBQ:abortTransaction

Conversation

@alinaliBQ

@alinaliBQ alinaliBQ commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This change adds tests for the $abortTransaction command operator. Adds execute_session_command and execute_abort_session_command to documentdb_tests/framework/executor.py.

Add command operator tests for $abortTransaction. Tests database $abortTransaction behavior, output collection, syntax, and expected errors.

@alinaliBQ

alinaliBQ commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Once #560 is merged, I can rebase this PR if there are conflicts.

@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels Jun 12, 2026
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: compatibility test, enhancement
Project fields suggested: Component test-coverage · Priority P2 · Effort L · Status In Progress
Confidence: 0.85 (mixed)

Reasoning

component from path globs (test-coverage, test-framework, ci); effort from diff stats (1817+0 LOC, 17 files); LLM: Adds new test coverage for the $abortTransaction command operator, covering behavior, output collection, syntax, and error cases — a meaningful functional addition to the test suite.

If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

@alinaliBQ alinaliBQ force-pushed the abortTransaction branch 2 times, most recently from 8780e5b to 8ecb689 Compare June 15, 2026 19:39
@alinaliBQ

Copy link
Copy Markdown
Contributor Author

Rebased PR to get fix from #606

@alinaliBQ alinaliBQ marked this pull request as ready for review June 16, 2026 19:51
@alinaliBQ alinaliBQ requested a review from a team as a code owner June 16, 2026 19:51
@alinaliBQ alinaliBQ force-pushed the abortTransaction branch 4 times, most recently from ff242bf to 91bd213 Compare June 24, 2026 21:10
Comment thread documentdb_tests/framework/executor.py Outdated
Returns:
Result dict (abort response or readback) or Exception.
"""
from documentdb_tests.compatibility.tests.core.sessions.commands.utils.session_test_case import ( # noqa: E501

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why import here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Function is moved to SessionTestCase file and import is removed

Comment thread documentdb_tests/framework/executor.py Outdated
return e


def execute_session_command(collection, test_case) -> Any:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

execute_session_command and execute_abort_session_command are ~95% duplicated. Recommend a single _execute_session_command(collection, test_case, *, abort: bool) with the divergent step
parameterized

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea good point, merged these 2 functions and moved _execute_session_command to SessionTestCase file.

]


@pytest.mark.admin

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the use of it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pytest.mark.admin allows users to filter with pytest -m admin to run only admin command tests. This tag indicates the test is an admin command test

Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>

@alinaliBQ alinaliBQ left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

addressed comments

Comment thread documentdb_tests/framework/executor.py Outdated
return e


def execute_session_command(collection, test_case) -> Any:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea good point, merged these 2 functions and moved _execute_session_command to SessionTestCase file.

Comment thread documentdb_tests/framework/executor.py Outdated
Returns:
Result dict (abort response or readback) or Exception.
"""
from documentdb_tests.compatibility.tests.core.sessions.commands.utils.session_test_case import ( # noqa: E501

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Function is moved to SessionTestCase file and import is removed

]


@pytest.mark.admin

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pytest.mark.admin allows users to filter with pytest -m admin to run only admin command tests. This tag indicates the test is an admin command test

Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility test Compatibility test related enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants