Skip to content

test(pyamber): share storage, RPC, and table test fixtures - #9623

Open
aglinxinyuan wants to merge 2 commits into
apache:mainfrom
aglinxinyuan:test/pyamber-test-fixtures
Open

aglinxinyuan wants to merge 2 commits into
apache:mainfrom
aglinxinyuan:test/pyamber-test-fixtures

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Shares repeated test setup, mock scaffolding, and assertion helpers across seven pyamber unit test suites without changing test coverage or production code:

  • Large binary output stream tests: introduces local context-manager helpers for paired S3 client/bucket patches and fresh test-value fixtures across test_large_binary_output_stream.py, preserving all literal assertions, patch lifetimes, thread-gate checks, and error scopes.
  • Async RPC and debug control-handler tests: extracts shared mock-handler, stream/payload factory, and invocation helpers across test_debug_command_handler.py, test_evaluate_expression_handler.py, test_async_rpc_client.py, and test_async_rpc_server.py.
  • Table and batch-operator tests: consolidates repeated batch/table construction and row-assertion helpers across test_table.py and test_count_batch_operator.py.

All existing test names and assertions are preserved.

Any related issues, documentation, discussions?

Closes #9622.

How was this PR tested?

Ran in amber/ against origin/main (f030df12b7) before and after the refactor on Python 3.12:

ruff check src/main/python src/test/python
ruff format --check src/main/python src/test/python
python -m pytest -p no:timeout \
  src/test/python/pytexera/storage/test_large_binary_output_stream.py \
  src/test/python/core/architecture/handlers/control/test_debug_command_handler.py \
  src/test/python/core/architecture/handlers/control/test_evaluate_expression_handler.py \
  src/test/python/core/architecture/rpc/test_async_rpc_client.py \
  src/test/python/core/architecture/rpc/test_async_rpc_server.py \
  src/test/python/core/models/test_table.py \
  src/test/python/pytexera/udf/examples/test_count_batch_operator.py
  • ruff check src/main/python src/test/python and ruff format --check src/main/python src/test/python: passed.
  • Baseline vs. patched JUnit XML comparison: 119 passed, 0 failed, 0 skipped (0 test name/outcome diffs across all 7 suites).
  • Negative mutation controls: breaking large_binary_output_stream.py (if large_binary is None:), async_rpc_server.py (return command_id < 0), and count_batch_operator.py (self.count += 1) each failed its guarding suite (rc=1), confirming the refactored assertions remain live.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Antigravity (Gemini), Claude Code (Claude Opus 5.5)

Deduplicate repeated S3 patch context helpers, RPC/handler mock builders, and table/batch-operator test fixtures across seven pyamber test files with identical test names and assertions.
Copilot AI balanced review requested due to automatic review settings November 22, 2026 03:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Yicong-Huang, @sshiv012, @carloea2
    You can notify them by mentioning @Yicong-Huang, @sshiv012, @carloea2 in a comment.

@codecov-commenter

codecov-commenter commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.68%. Comparing base (f030df1) to head (05455da).
⚠️ Report is 8 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9623   +/-   ##
=========================================
  Coverage     91.68%   91.68%           
  Complexity     5135     5135           
=========================================
  Files          1302     1302           
  Lines         58119    58120    +1     
  Branches       7582     7582           
=========================================
+ Hits          53285    53286    +1     
  Misses         2923     2923           
  Partials       1911     1911           
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 46354e4
agent-service 99.56% <ø> (ø) Carriedforward from 46354e4
amber 85.76% <ø> (ø) Carriedforward from 46354e4
computing-unit-managing-service 63.83% <ø> (ø) Carriedforward from 46354e4
config-service 87.50% <ø> (ø) Carriedforward from 46354e4
file-service 82.16% <ø> (ø) Carriedforward from 46354e4
frontend 96.46% <ø> (ø) Carriedforward from 46354e4
notebook-migration-service 83.77% <ø> (ø) Carriedforward from 46354e4
pyamber 98.38% <ø> (+<0.01%) ⬆️
result-service 85.71% <ø> (ø) Carriedforward from 46354e4
workflow-compiling-service 78.30% <ø> (ø) Carriedforward from 46354e4

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 1 better · 🔴 4 worse · ⚪ 10 noise (<±5%) · 0 without baseline

Compared against main f030df1 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 693 0.423 13,577/21,301/21,301 us 🟢 -9.0% / 🔴 +63.4%
⚪ bs=100 sw=10 sl=64 1,715 1.047 57,560/68,430/68,430 us ⚪ within ±5% / 🟢 -29.4%
🔴 bs=1000 sw=10 sl=64 1,951 1.191 500,106/630,212/630,212 us 🔴 +9.8% / 🟢 +33.2%
Baseline details

Latest main f030df1 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 693 tuples/sec 716 tuples/sec 1,055 tuples/sec -3.2% -34.3%
bs=10 sw=10 sl=64 MB/s 0.423 MB/s 0.437 MB/s 0.644 MB/s -3.2% -34.3%
bs=10 sw=10 sl=64 p50 13,577 us 14,916 us 9,804 us -9.0% +38.5%
bs=10 sw=10 sl=64 p95 21,301 us 19,835 us 13,039 us +7.4% +63.4%
bs=10 sw=10 sl=64 p99 21,301 us 19,835 us 15,330 us +7.4% +39.0%
bs=100 sw=10 sl=64 throughput 1,715 tuples/sec 1,730 tuples/sec 1,418 tuples/sec -0.9% +20.9%
bs=100 sw=10 sl=64 MB/s 1.047 MB/s 1.056 MB/s 0.866 MB/s -0.9% +20.9%
bs=100 sw=10 sl=64 p50 57,560 us 56,890 us 76,126 us +1.2% -24.4%
bs=100 sw=10 sl=64 p95 68,430 us 69,898 us 83,699 us -2.1% -18.2%
bs=100 sw=10 sl=64 p99 68,430 us 69,898 us 96,885 us -2.1% -29.4%
bs=1000 sw=10 sl=64 throughput 1,951 tuples/sec 2,011 tuples/sec 1,465 tuples/sec -3.0% +33.2%
bs=1000 sw=10 sl=64 MB/s 1.191 MB/s 1.227 MB/s 0.894 MB/s -2.9% +33.2%
bs=1000 sw=10 sl=64 p50 500,106 us 489,471 us 744,765 us +2.2% -32.9%
bs=1000 sw=10 sl=64 p95 630,212 us 573,731 us 781,322 us +9.8% -19.3%
bs=1000 sw=10 sl=64 p99 630,212 us 573,731 us 823,669 us +9.8% -23.5%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,288.67,200,128000,693,0.423,13577.17,21301.30,21301.30
1,100,10,64,20,1166.14,2000,1280000,1715,1.047,57559.92,68430.27,68430.27
2,1000,10,64,20,10252.37,20000,12800000,1951,1.191,500105.68,630211.88,630211.88

@aglinxinyuan
aglinxinyuan requested a review from kunwp1 November 23, 2026 11:19

@kunwp1 kunwp1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

- Give `_make_channel` an `is_control` parameter so `_dispatch` reuses it
  instead of building the same `ChannelIdentity` inline.
- Keep the literal expected DataFrame in `test_table.py`, so
  `test_table_from_data_frame` and `test_use_table_as_data_frame` compare
  against values and column order that do not come from
  `target_raw_tuples`.
- Restore `@pytest.mark.timeout(5)` on
  `test_write_unblocks_when_upload_fails_with_full_queue` (`close()` joins
  the upload thread with no limit) and patch S3 through `_mock_s3_upload()`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Share Python storage, RPC, and table test fixtures in pyamber

4 participants