Skip to content

Add dropConnections administration command tests#628

Open
imforster wants to merge 1 commit into
documentdb:mainfrom
imforster:forstaia/administration/dropConnections
Open

Add dropConnections administration command tests#628
imforster wants to merge 1 commit into
documentdb:mainfrom
imforster:forstaia/administration/dropConnections

Conversation

@imforster

Copy link
Copy Markdown
Collaborator

#526
Test cases: 76
Docs: https://www.mongodb.com/docs/v8.2/reference/command/dropConnections/

Summary

Adds comprehensive tests for dropConnections administration command using proper DRY parametrization patterns.

Changes

  • init.py: Package marker for dropConnections test directory
  • test_dropConnections_core_behavior.py: Parametrized tests for valid hostAndPort arrays, silent ignore behavior (no-colon entries), and host:port parse rejection (invalid port, empty host, multiple colons)
  • test_dropConnections_argument_handling.py: Uses bson_type_validator for exhaustive hostAndPort type rejection (15 BSON types), null-as-missing, array element type validation, command field value acceptance (all 17 BSON types), and unrecognized field rejection
  • test_dropConnections_comment.py: Parametrized tests for comment field acceptance (all 17 BSON types)

What was tested

All 76 tests pass against MongoDB:

  • Core behavior: empty array, valid host:port, IP address, IPv6, duplicates, idempotency
  • Silent ignore: entries without a colon (no port separator)
  • Host parse rejection: empty host, empty port, port 0, high port, non-numeric port, negative port, multiple colons
  • BSON type exhaustiveness for hostAndPort field (type rejection)
  • Array element type validation (non-string rejection, null ignored)
  • Command field value acceptance (all BSON types)
  • Comment field acceptance (all BSON types)
  • Missing hostAndPort field and null hostAndPort → MISSING_FIELD_ERROR
  • Unrecognized top-level field → UNRECOGNIZED_COMMAND_FIELD_ERROR

Signed-off-by: Ian Forster <forstaia@amazon.com>
@imforster imforster requested a review from a team as a code owner June 19, 2026 17:28
@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels Jun 19, 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 M · Status Needs Review
Confidence: 0.92 (mixed)

Reasoning

component from path globs (test-coverage); effort from diff stats (400+0 LOC, 4 files); LLM: Adds 76 new parametrized compatibility test cases for the dropConnections admin command, expanding test coverage across core behavior, argument handling, and comment field acceptance.

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.

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.

1 participant