Skip to content

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

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:test/pyamber-test-fixtures
Nov 23, 2026
Merged

aglinxinyuan merged 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

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 2 better · 🔴 7 worse · ⚪ 6 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 426 0.26 22,952/31,248/31,248 us 🔴 +21.1% / 🔴 +133.3%
🔴 bs=100 sw=10 sl=64 852 0.52 116,353/147,222/147,222 us 🔴 +20.7% / 🔴 +70.5%
🔴 bs=1000 sw=10 sl=64 970 0.592 1,032,668/1,111,135/1,111,135 us 🔴 +6.2% / 🔴 +36.4%
Baseline details

Latest main f030df1 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 426 tuples/sec 462 tuples/sec 993.83 tuples/sec -7.8% -57.1%
bs=10 sw=10 sl=64 MB/s 0.26 MB/s 0.282 MB/s 0.607 MB/s -7.8% -57.1%
bs=10 sw=10 sl=64 p50 22,952 us 18,951 us 10,119 us +21.1% +126.8%
bs=10 sw=10 sl=64 p95 31,248 us 32,992 us 13,394 us -5.3% +133.3%
bs=10 sw=10 sl=64 p99 31,248 us 32,992 us 16,114 us -5.3% +93.9%
bs=100 sw=10 sl=64 throughput 852 tuples/sec 893 tuples/sec 1,327 tuples/sec -4.6% -35.8%
bs=100 sw=10 sl=64 MB/s 0.52 MB/s 0.545 MB/s 0.81 MB/s -4.6% -35.8%
bs=100 sw=10 sl=64 p50 116,353 us 112,674 us 79,097 us +3.3% +47.1%
bs=100 sw=10 sl=64 p95 147,222 us 121,926 us 86,335 us +20.7% +70.5%
bs=100 sw=10 sl=64 p99 147,222 us 121,926 us 94,338 us +20.7% +56.1%
bs=1000 sw=10 sl=64 throughput 970 tuples/sec 984 tuples/sec 1,363 tuples/sec -1.4% -28.8%
bs=1000 sw=10 sl=64 MB/s 0.592 MB/s 0.601 MB/s 0.832 MB/s -1.5% -28.8%
bs=1000 sw=10 sl=64 p50 1,032,668 us 1,017,141 us 774,633 us +1.5% +33.3%
bs=1000 sw=10 sl=64 p95 1,111,135 us 1,046,537 us 814,584 us +6.2% +36.4%
bs=1000 sw=10 sl=64 p99 1,111,135 us 1,046,537 us 858,914 us +6.2% +29.4%
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,469.24,200,128000,426,0.260,22952.09,31248.46,31248.46
1,100,10,64,20,2347.56,2000,1280000,852,0.520,116352.51,147221.78,147221.78
2,1000,10,64,20,20613.93,20000,12800000,970,0.592,1032667.87,1111134.76,1111134.76

@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 <[email protected]>
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Nov 23, 2026
Merged via the queue into apache:main with commit 5295e7f Nov 23, 2026
31 checks passed
@aglinxinyuan
aglinxinyuan deleted the test/pyamber-test-fixtures branch November 23, 2026 23:32
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Nov 25, 2026
…9686)

### What changes were proposed in this PR?

Remove code that nothing uses, and constructs that repeat a default or
an alias, from the Python tests, the agent service, three frontend
specs, the AsterixDB source and the RustFS test container, and make an
unreachable error check in the single-node example loader reachable
(**+84/−137 lines**). Only the loader's behavior changes: a workflow
file that `jq` cannot parse is now reported and skipped instead of
aborting the loader.

- **Python tests (14 files):** `test_console_message.py` drops the
unused `internal_queue` and `timed_buffer` fixtures and their imports.
Two tests drop fixture parameters they never read (`executor`,
`a_timestamp`), and `test_proxy_client.py` names an unused loop value
`_`. The others write `dict(...)` calls as literals, return from
fixtures that yield without teardown, drop empty `@pytest.fixture()`
parentheses, merge nested `with` blocks, return a value directly instead
of through a local, take the first element with `next(iter(...))`, and
spell `datetime.timezone.utc`, `socket.timeout` and `bytes()` as
`datetime.UTC`, `TimeoutError` and `b""` (Ruff targets Python 3.11).
- **Agent service:** `src/agent/index.ts` and `src/api/index.ts` only
re-export modules that callers import directly. No file imports either
barrel, and the package entry is `src/index.ts`.
`workflow-system-metadata.ts` drops the unused `OperatorSchema` and
`ValidationError` type imports.
- **Frontend specs:** the dataset and model creator specs drop
`FormsModule` and `HttpClientTestingModule`, which
`createFormlyModalFixture` already provides, and the admin Gmail spec
drops three modules that the standalone component and its stubbed
service do not need.
- **`load-examples.sh`:** tests the `content=$(jq -c .
"$workflow_file")` assignment in the `if` instead of checking `$?` after
it. The script runs under `set -euo pipefail` and `main` calls
`load_workflows` directly, so the old check could never fire: a workflow
file that `jq` could not parse aborted the loader and skipped the files
after it, although the comment above `FAILURES` calls each failure
deliberately non-fatal. Now `print_error` counts the file, the loop
moves on, and `main` still exits non-zero at the end.
`test_load_examples_sh.sh` adds a case with an unparseable workflow
sorted ahead of a good one.
- **AsterixDB source:** `AsterixDBConnUtil` and `AsterixDBSourceOpExec`
assign the version response and the parsed row once as `val`s instead of
overwriting `null` and `None` placeholders.
- **`RustFSContainer`:** drops the Scaladoc lines saying the console is
left disabled. RustFS 1.0.0 enables the console by default, and the
fixture does not override it.

| Event | PR / Commit |
| --- | --- |
| Introduced by | Python tests: apache#1259 (2021-07-23), apache#1498 (2022-04-15),
apache#1452 (2022-05-13), apache#2067 (2023-07-27), apache#1748 (2023-11-09), apache#2815
(2024-09-05), apache#4520 (2026-04-27), apache#4704, apache#4719 and apache#4795 (2026-05-03),
apache#4893 (2026-05-04), apache#6643 (2026-07-20), apache#6988 (2026-07-29), apache#7374
(2026-08-07), apache#7579 (2026-08-13), apache#8067 (2026-08-29), apache#8542
(2026-09-15), apache#9279 (2026-11-04), apache#8704 (2026-11-05), apache#9623
(2026-11-23); agent service: apache#4020 (2025-11-25), apache#4495 and apache#4540
(2026-04-28); frontend specs: apache#6513 (2026-07-18), apache#6576 (2026-07-20),
apache#8068 (2026-08-28); `load-examples.sh`: apache#4247 (2026-03-02); AsterixDB
source: apache#1044 (2021-02-25); `RustFSContainer`: apache#8542 (2026-09-15) |
| Usage removed by | Creator spec modules: apache#9522 (2026-11-22,
`refactor(frontend): share dataset and model resource UI`) moved both
specs to `createFormlyModalFixture`. Everything else: unused,
unreachable or redundant since introduction. |

As of 2026-11-24:
- The AsterixDB placeholders have been overwritten before any read for
over 5 years.
- The console-message fixtures have been unused for over 2 years.
- The `load-examples.sh` check has been unreachable for almost 9 months.
- The agent-service barrels have had no importer for the 7 months the
service has existed.
- The creator spec modules have been redundant for 2 days.

### Any related issues, documentation, discussions?

Closes apache#9685.

### How was this PR tested?

Ran on this branch and on `main` at `424b2a757a` (Windows 11; Python
3.12 with CI's pinned `ruff` 0.14.7; Node 24 with Yarn 4.14.1; Bun
1.3.13; JDK 17; the loader test in an Alpine container with Bash 5.2.21
and jq 1.7.1):

```bash
cd amber
ruff check src/main/python src/test/python
ruff format --check src/main/python src/test/python
pytest $(git diff --name-only --relative origin/main -- src/test/python)
cd ../agent-service
bun test
bun run typecheck
cd ../frontend
npx ng test --watch=false --include='**/user-dataset-creator.component.spec.ts' --include='**/user-model-creator.component.spec.ts' --include='**/admin-gmail.component.spec.ts'
npx tsc --noEmit -p src/tsconfig.spec.json
yarn prettier-eslint --list-different $(git diff --name-only --relative origin/main -- src)
yarn eslint $(git diff --name-only --relative origin/main -- src)
cd ..
sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.source.sql.*" WorkflowCore/Test/compile WorkflowOperator/scalafmtCheckAll WorkflowCore/scalafmtCheckAll "WorkflowOperator/scalafixAll --check" "WorkflowCore/scalafixAll --check"
bash bin/single-node/tests/test_load_examples_sh.sh
```

- **Python:**
  - Ruff passes on all 218 files.
- The 14 changed test files run 288 tests with the same outcome per test
on both sides: 218 pass, 67 are skipped and 3 fail.
- The three failures are timestamp cases in
`test_ui_parameter_contract.py` that expect UTC and come out 8 hours off
in this machine's time zone. They fail the same way on `main`.
- **Agent service:** all 361 tests in 20 files and the typecheck pass on
both sides.
- **Frontend:** the three specs run 37 tests, all passing on both sides.
The spec typecheck, prettier-eslint and ESLint pass.
- **Scala:** the 11 `source.sql` suites, including the three AsterixDB
specs, run 204 tests that all pass on both sides. WorkflowCore's tests
compile, and scalafmt and scalafix pass on both modules.
- **`load-examples.sh`:** `test_load_examples_sh.sh` passes all 11
checks. Against `main`'s loader, the 9 existing checks pass and the 2
new ones fail: `jq` exits 5 at the malformed file, and the loader stops
there without creating the other workflow.

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

Generated-by: Claude Code (Claude Opus 5.5)
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