Skip to content

Add top tests#636

Open
alinaliBQ wants to merge 8 commits into
documentdb:mainfrom
alinaliBQ:top
Open

Add top tests#636
alinaliBQ wants to merge 8 commits into
documentdb:mainfrom
alinaliBQ:top

Conversation

@alinaliBQ

@alinaliBQ alinaliBQ commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Add command operator tests for top. Tests database top behavior, output collection, syntax, and errors.
Adds setup field in DiagnosticTestCase.

@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels Jun 22, 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); effort from diff stats (694+1 LOC, 7 files); LLM: Adds new test coverage for the top command operator, spanning behavior, output, syntax, and error cases within the compatibility 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 marked this pull request as ready for review June 22, 2026 21:29
@alinaliBQ alinaliBQ requested a review from a team as a code owner June 22, 2026 21:29
ns_data = result["totals"].get(ns)
assertProperties(
{"ns_entry": ns_data},
{"ns_entry": Exists()},

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.

Three "appears in totals" tests use a wrapper-dict Exists()that can never fail. .get(ns) will return None is "totals" not exist in result.

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.

changed to use result["totals"][ns1] for direct access

list(collection.find())
result = execute_admin_command(collection, test.command)
ns = f"{collection.database.name}.{collection.name}"
ns_data = result["totals"][ns]

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.

Multple places using the direct reference result["totals"][ns], will raise KeyError instead of a clean assertion failure when the namespace is absent. Use .get(ns) here in all places.

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.

removed result["totals"][ns] checks and switched to use get(ns)

Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
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

ns_data = result["totals"].get(ns)
assertProperties(
{"ns_entry": ns_data},
{"ns_entry": Exists()},

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.

changed to use result["totals"][ns1] for direct access

list(collection.find())
result = execute_admin_command(collection, test.command)
ns = f"{collection.database.name}.{collection.name}"
ns_data = result["totals"][ns]

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.

removed result["totals"][ns] checks and switched to use get(ns)

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