Skip to content

test(frontend): share HTTP service and computing-unit fixtures - #9722

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:test/frontend-service-fixtures
Nov 26, 2026
Merged

aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:test/frontend-service-fixtures

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Two groups of frontend specs set up the same things by hand. They now share two test helpers:

  • common/testing/http-service-test-utils.ts: setupHttpServiceTest configures the testing module with HttpClientTestingModule for a service and returns the service with HttpTestingController, and flushHttpRequest expects one request, checks its method (and its body, response type, content type or query params when a test gives them) and flushes the response. The auth, Google and Apple sign-in, user config, GUI config, Gmail, warehouse, deployment version, computing-unit managing, admin and feedback service specs and the login page spec use them.
  • common/testing/computing-unit-test-fixtures.ts: makeDashboardComputingUnit builds a computing-unit record with per-test overrides of the record and its resource limits, makeLocalComputingUnit builds a local unit, and NAN_COMPUTING_UNIT_RESOURCE holds the unknown limits. The creation modal, status service, admin and user computing-unit, cluster capacity, list item, utility and dashboard type specs use them.

The specs also stop registering services that are already provided in root and keep their named mocks. Every test keeps its name, its inputs and its expected values, in the same order.

Any related issues, documentation, discussions?

Closes #9721.

How was this PR tested?

  • ng test --watch=false from frontend: the 7,428 cases in the 256 spec files have the same names, outcomes and order within each file on main and on this branch, compared case by case from junit.xml.
  • Mutation check: five breaks, each reverted afterwards, made their guarding specs fail: flushHttpRequest expecting GET for every request (30 of 170 cases), expecting a null body (21 of 170), setupHttpServiceTest dropping the extra providers (68 of 170), makeDashboardComputingUnit ignoring resource overrides (7 of 193), and the login spec's provider checks swapping the ORCID and Apple buttons (4 of 64).
  • yarn format:ci, npx tsc --noEmit -p src/tsconfig.app.json and npx tsc --noEmit -p src/tsconfig.spec.json

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

Generated-by: Antigravity (Gemini), Codex (GPT-6) and Claude Code (Claude Opus 5.5)

The HTTP service specs each configured the testing module and flushed
their expected requests by hand, and the computing-unit specs each built
their unit records by hand; several also registered services that are
already provided in root. They now share setupHttpServiceTest,
flushHttpRequest and the computing-unit record builders, and drop the
redundant registrations while keeping their named mocks.
@aglinxinyuan
aglinxinyuan requested review from kunwp1 and a balanced review from Copilot November 26, 2026 06:08

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 github-actions Bot added the frontend Changes related to the frontend GUI label Nov 26, 2026
@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: @kunwp1, @mengw15, @Neilk1021
    You can notify them by mentioning @kunwp1, @mengw15, @Neilk1021 in a comment.

@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! Three nits below.

…s local

- The login spec's provider cases name each node they check. As on main,
  the Apple-only case does not check the Google button.
- The dashboard-entry case gets its asserted WRITE access from its own
  input, not the shared default.
- makeDashboardComputingUnit always merges the resource limits. The one
  case that needs no resource clears the field itself.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.77%. Comparing base (fdfe99c) to head (73f57f6).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...app/common/testing/computing-unit-test-fixtures.ts 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9722      +/-   ##
============================================
- Coverage     91.78%   91.77%   -0.02%     
  Complexity     5135     5135              
============================================
  Files          1306     1308       +2     
  Lines         58243    58079     -164     
  Branches       7576     7558      -18     
============================================
- Hits          53458    53301     -157     
+ Misses         2893     2889       -4     
+ Partials       1892     1889       -3     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from e58661a
agent-service 99.56% <ø> (ø) Carriedforward from e58661a
amber 85.94% <ø> (ø) Carriedforward from e58661a
computing-unit-managing-service 63.81% <ø> (ø) Carriedforward from e58661a
config-service 87.50% <ø> (ø) Carriedforward from e58661a
file-service 82.16% <ø> (ø) Carriedforward from e58661a
frontend 96.44% <96.42%> (+<0.01%) ⬆️
notebook-migration-service 83.84% <ø> (ø) Carriedforward from e58661a
pyamber 98.70% <ø> (ø) Carriedforward from e58661a
result-service 86.48% <ø> (ø) Carriedforward from e58661a
workflow-compiling-service 80.90% <ø> (ø) Carriedforward from e58661a

*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.

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Nov 26, 2026
Merged via the queue into apache:main with commit aa5fe9d Nov 26, 2026
28 checks passed
@aglinxinyuan
aglinxinyuan deleted the test/frontend-service-fixtures branch November 26, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Share frontend HTTP service and computing-unit spec fixtures

4 participants