Skip to content

Add $connectionStatus tests#237

Open
PatersonProjects wants to merge 4 commits into
documentdb:mainfrom
PatersonProjects:connectionStatus_tests
Open

Add $connectionStatus tests#237
PatersonProjects wants to merge 4 commits into
documentdb:mainfrom
PatersonProjects:connectionStatus_tests

Conversation

@PatersonProjects
Copy link
Copy Markdown
Contributor

This PR adds the tests for validating the $connectionStatus diagnostic command, primarily through type checking of response parameters.

Ref: Issue #43

Signed-off-by: PatersonProjects <[email protected]>
…dded missing coverage, reorganized tests for clarity

Signed-off-by: PatersonProjects <[email protected]>
Signed-off-by: PatersonProjects <[email protected]>
@PatersonProjects PatersonProjects requested a review from a team as a code owner May 25, 2026 22:08
@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels May 25, 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 Needs Review
Confidence: 0.80 (mixed)

Reasoning

component from path globs (test-coverage); effort from diff stats (377+2 LOC, 8 files); LLM: Adds new test cases for the $connectionStatus diagnostic command, which is a straightforward test coverage expansion in the compatibility tests area.

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.

timestamp, minKey, maxKey) as the command field value and returns ok: 1 for each.
"""

from __future__ import annotations
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.

I think this might not be necessary. Please remove as we are running from python 3.9+

entirely should exclude authenticatedUserPrivileges from the response.
"""

from __future__ import annotations
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.

please remove see above comment

ConnStatusArgTest("regex", value=Regex("test"), msg="regex should succeed"),
ConnStatusArgTest("timestamp", value=Timestamp(0, 0), msg="timestamp should succeed"),
ConnStatusArgTest("minKey", value=MinKey(), msg="minKey should succeed"),
ConnStatusArgTest("maxKey", value=MaxKey(), msg="maxKey should succeed"),
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.

missing javascript Code

]

FALSY_TESTS: list[ShowPrivTest] = [
ShowPrivTest("false", show_priv=False, msg="false should hide privileges"),
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.

Please add missing test case negative value -1 , -1.0

error_code=TYPE_MISMATCH_ERROR,
msg="showPrivileges minKey should be rejected as wrong type",
),
DiagnosticErrorTest(
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.

missing binData, regex, timestamp, and javascript code

@@ -0,0 +1,58 @@
"""Tests for connectionStatus command argument validation.

Verifies that connectionStatus accepts all 18 BSON types (int, double, long,
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.

as some of the BSON type are deprecated, we might not be testing all 18 BSON types. Please update this doc string

Signed-off-by: PatersonProjects <[email protected]>
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.

2 participants