Skip to content

Add setQuerySettings tests#610

Open
alinaliBQ wants to merge 19 commits into
documentdb:mainfrom
alinaliBQ:setQuerySettings
Open

Add setQuerySettings tests#610
alinaliBQ wants to merge 19 commits into
documentdb:mainfrom
alinaliBQ:setQuerySettings

Conversation

@alinaliBQ

@alinaliBQ alinaliBQ commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This change adds tests for the setQuerySettings command operator. In order to define the SettingsTestCase class, I renamed query-planning to query_planning. Reason is that hyphens aren't allowed in identifiers, so directories that need to be imported must use underscores instead.

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

Edit: replica_set is needed because query settings are not supported on standalone instances

alinaliBQ added 17 commits June 15, 2026 12:49
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>
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>
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
@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 XL · Status In Progress
Confidence: 0.85 (mixed)

Reasoning

component from path globs (test-coverage, test-framework); effort from diff stats (3863+1 LOC, 31 files); LLM: Adds new test coverage for the setQuerySettings command operator, covering behavior, output, syntax, and error cases — a functional test expansion across multiple test scenarios.

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.

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

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.

In order to define the SettingsTestCase class, I renamed query-planning to query_planning. Reason is that hyphens aren't allowed in identifiers, so directories that need to be imported must use underscores instead.

Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
@alinaliBQ alinaliBQ marked this pull request as ready for review June 16, 2026 18:45
@alinaliBQ alinaliBQ requested a review from a team as a code owner June 16, 2026 18:45
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>

@pytest.mark.admin
@pytest.mark.replica_set
@pytest.mark.parametrize("test", pytest_params(SET_QUERY_SETTINGS_REMOVE_TESTS))

@karthikvarma22 karthikvarma22 Jun 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why no_parallel in this CR ?

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.

no_parallel is only used in the smoke test. Perhaps you meant replica_set? In that case, replica set is required to enable query settings.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ack

@pytest.mark.parametrize("test", pytest_params(SET_QUERY_SETTINGS_RESPONSE_TESTS))
def test_setQuerySettings_response(collection, test):
"""Test setQuerySettings response structure."""
ctx = CommandContext.from_collection(collection)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks like this skeleton is present in most of files. Do we need a shared runner ?

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.

Could you clarify on what you mean by shared runner? Currently CI is set up to use a shared mongodb instance.
According to the style guide, it says the tests should be as standalone as possible and that helper functions that hide the test logic need to be avoided, so we needed to have separate def test_* functions.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Got it.

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