Skip to content

Add 92 smoke tests, no_parallel marker, and two-phase parallel handling: window operators, query-and-write, query-planning, sessions, administration, diagnostic, security (auth/roles/users)#72

Open
fanyangv wants to merge 1 commit intodocumentdb:mainfrom
fanyangv:add-smoke-tests-batch-4

Conversation

@fanyangv
Copy link
Copy Markdown
Collaborator

@fanyangv fanyangv commented Apr 9, 2026

Closes #60

  • 92 smoke tests for: window operators (28), query-and-write commands (6), query planning (4), sessions (5), system administration (13), diagnostics (18), security (18)
  • Add no_parallel pytest marker for 14 tests that modify global server state (kill sessions/ops, set parameters, drop all users/roles)
  • Add pytest_collection_modifyitems hook to auto-deselect no_parallel tests under xdist
  • Add pytest_sessionfinish hook to automatically run no_parallel tests sequentially after parallel phase
  • Add worker_id fallback fixture for running without xdist
  • Update README with two-phase execution docs

@fanyangv fanyangv requested a review from a team as a code owner April 9, 2026 02:16
@fanyangv fanyangv force-pushed the add-smoke-tests-batch-4 branch 2 times, most recently from a4a5118 to c96deb4 Compare April 10, 2026 04:14
@fanyangv fanyangv changed the title Add 92 smoke tests (4th batch) and no_parallel marker Add 92 smoke tests, no_parallel marker, and two-phase parallel handling: window operators, query-and-write, query-planning, sessions, administration, diagnostic, security (auth/roles/users) Apr 10, 2026
@fanyangv fanyangv force-pushed the add-smoke-tests-batch-4 branch from c96deb4 to 1f88ffc Compare April 10, 2026 04:19
…ng: window operators, query-and-write, query-planning, sessions, administration, diagnostic, security (auth/roles/users)

Smoke tests (92): window operators (28), query-and-write commands (6),
query planning (4), sessions (5), system administration (13),
diagnostics (18), security (18).

Add no_parallel pytest marker for 14 tests that modify global server
state (kill sessions/ops, set parameters, drop all users/roles):
- Sessions (4): killSessions, killAllSessions, killAllSessionsByPattern, dropConnections
- Server config (3): setParameter, setClusterParameter, setFeatureCompatibilityVersion
- Server ops (2): killOp, fsync
- Maintenance (2): logRotate, rotateCertificates
- Security (3): dropAllUsersFromDatabase, dropAllRolesFromDatabase, invalidateUserCache

Add pytest_collection_modifyitems hook to auto-deselect no_parallel tests under xdist.
Add pytest_sessionfinish hook to run no_parallel tests sequentially after parallel phase.
Add worker_id fallback fixture for running without xdist.
Update README with two-phase execution docs.

Signed-off-by: Fan Yang <vfanyang@amazon.com>
@fanyangv fanyangv force-pushed the add-smoke-tests-batch-4 branch from 1f88ffc to ef62582 Compare April 10, 2026 21:58
@eerxuan
Copy link
Copy Markdown
Collaborator

eerxuan commented Apr 18, 2026

Verified locally: two-phase parallel handling works correctly

  • Phase 1 (parallel, -n auto): 674 tests passed in 20.75s — no_parallel tests deselected
  • Phase 2 (sequential, automatic): 14 no_parallel tests passed in 5.12s

One issue found:

⚠️ Failed to merge JSON reports: [Errno 2] No such file or directory: '.report.json'

When --json-report is not explicitly passed, the json_report_file option still has a default value (.report.json) from the plugin. Phase 2 sees this default, generates a temp report, and tries to merge into a file that Phase 1 never wrote.

Fix: check if Phase 1 report actually exists before merging. If it doesn't exist and Phase 2's does, either copy Phase 2's report as the final report or skip silently (no warning):

if phase1_json and phase2_json and os.path.exists(phase2_json):
    if os.path.exists(phase1_json):
        _merge_json_reports(phase1_json, phase2_json)
    else:
        # Phase 1 didn't write a report (--json-report not passed)
        # Skip merge silently — Phase 2 temp file will be cleaned up
        pass

Same applies to JUnit XML merge.

@eerxuan
Copy link
Copy Markdown
Collaborator

eerxuan commented Apr 18, 2026

Minor: tempfile.mktemp is deprecated (https://docs.python.org/3/library/tempfile.html#tempfile.mktemp). Consider tempfile.NamedTemporaryFile(delete=False, suffix=".json", prefix="phase2_") instead. Not a practical concern here, just a lint/best-practice thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 92 smoke tests (4th batch)

2 participants