Skip to content

test(frontend): cover ComputingUnitSelectionComponent resource-formatting and status getters#6756

Open
mengw15 wants to merge 9 commits into
apache:mainfrom
mengw15:chore/6745-computing-unit-getters-test
Open

test(frontend): cover ComputingUnitSelectionComponent resource-formatting and status getters#6756
mengw15 wants to merge 9 commits into
apache:mainfrom
mengw15:chore/6745-computing-unit-getters-test

Conversation

@mengw15

@mengw15 mengw15 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Extends the existing ComputingUnitSelectionComponent spec to cover its
previously-untested resource-formatting and status-display getters
(frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts).
The selected computing unit is seeded directly so each getter's own logic is
exercised.

13 tests cover: fallbacks when no unit is selected; getButtonText /
computeStatus / isComputingUnitRunning across statuses; the raw gpu / jvm /
shared-memory passthroughs; getCpuLimit / getMemoryLimit; the display-unit
derivation (empty cpu unit → "Cores", empty memory unit → "B"); the N/A-metrics
0% / success case and a real cpu percentage; getBadgeColor;
getUnitStatusTooltip; cannotSelectUnit / isSelectedUnit; isCreateDisabled;
and the trackByCuid / trackByIndex identities.

No production code was changed.

Any related issues, documentation, discussions?

Closes #6745

How was this PR tested?

New unit tests, run locally in frontend/ (all green; the failure path was
verified by breaking an assertion to confirm the suite goes red):

ng test --watch=false --include src/app/workspace/component/power-button/computing-unit-selection.component.spec.ts
# Test Files 1 passed (1) | Tests 113 passed (113)
prettier --write <spec>   # clean
eslint  <spec>            # clean

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

Generated-by: Claude Code (Opus 4.8 [1M context])

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jul 22, 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:

  • No candidates found from git blame history.

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.

Pull request overview

This PR adds additional frontend unit tests for ComputingUnitSelectionComponent’s resource-formatting and status/display getters, aiming to increase coverage of pure getter logic without changing production code.

Changes:

  • Added a new spec block exercising getter behavior for selected vs. unselected computing units.
  • Added cases for unit parsing/formatting (CPU/memory limits & units) and status-related getters (badge color, tooltip, selection rules).
  • Added coverage for non-zero CPU usage percentage computation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mengw15
mengw15 force-pushed the chore/6745-computing-unit-getters-test branch from 776713e to 80cbd94 Compare July 22, 2026 05:38

@aglinxinyuan aglinxinyuan 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!

@aglinxinyuan
aglinxinyuan enabled auto-merge July 22, 2026 05:40
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 22, 2026
@codecov-commenter

codecov-commenter commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.65%. Comparing base (dda9e83) to head (7d3e4eb).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6756      +/-   ##
============================================
- Coverage     76.28%   75.65%   -0.63%     
  Complexity     3452     3452              
============================================
  Files          1161     1161              
  Lines         45916    45915       -1     
  Branches       5099     5099              
============================================
- Hits          35025    34736     -289     
- Misses         9327     9566     +239     
- Partials       1564     1613      +49     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from dab5e14
agent-service 76.76% <ø> (ø) Carriedforward from dab5e14
amber 67.33% <ø> (-0.01%) ⬇️ Carriedforward from dab5e14
computing-unit-managing-service 20.49% <ø> (ø) Carriedforward from dab5e14
config-service 66.66% <ø> (ø) Carriedforward from dab5e14
file-service 67.21% <ø> (ø) Carriedforward from dab5e14
frontend 80.29% <ø> (-1.44%) ⬇️ Carriedforward from dab5e14
notebook-migration-service 78.94% <ø> (ø) Carriedforward from dab5e14
pyamber 92.15% <ø> (ø) Carriedforward from dab5e14
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from dab5e14

*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 removed this pull request from the merge queue due to a manual request Jul 22, 2026
@aglinxinyuan

Copy link
Copy Markdown
Contributor

Not increasing coverage.

@aglinxinyuan

Copy link
Copy Markdown
Contributor

Reopen to test the coverage again.

@aglinxinyuan aglinxinyuan reopened this Jul 22, 2026
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.

add unit test coverage for ComputingUnitSelectionComponent resource-formatting getters

4 participants