Skip to content

power-policy-service: Add test coverage for provider power#762

Open
RobertZ2011 wants to merge 1 commit intoOpenDevicePartnership:v0.2.0from
RobertZ2011:power-policy-provider-power-test
Open

power-policy-service: Add test coverage for provider power#762
RobertZ2011 wants to merge 1 commit intoOpenDevicePartnership:v0.2.0from
RobertZ2011:power-policy-provider-power-test

Conversation

@RobertZ2011
Copy link
Contributor

No description provided.

@RobertZ2011 RobertZ2011 self-assigned this Mar 25, 2026
Copilot AI review requested due to automatic review settings March 25, 2026 22:04
Copy link
Contributor

Copilot AI left a comment

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 extends the power-policy-service test suite to validate total provider power computations, by making the service instance accessible from tests and asserting expected totals during provider lifecycle flows.

Changes:

  • Wrap the power policy Service in a shared Mutex and pass it into test closures via run_test.
  • Add assertions in provider tests for compute_total_provider_power_mw() across connect/upgrade/detach/disconnect scenarios.
  • Add a consumer test assertion ensuring consumer events don’t affect provider power totals.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
power-policy-service/tests/common/mod.rs Refactors test harness to share the service via ServiceMutex and pass it into test functions.
power-policy-service/tests/provider.rs Adds provider-power total assertions throughout provider flow tests.
power-policy-service/tests/consumer.rs Adds a provider-power total assertion in consumer flow and updates test signatures for the new service argument.
power-policy-service/tests/unconstrained.rs Updates test signature/imports to accept the new service argument.

@RobertZ2011 RobertZ2011 force-pushed the power-policy-provider-power-test branch from f21a6f7 to 104dfaf Compare March 25, 2026 22:52
@RobertZ2011 RobertZ2011 marked this pull request as ready for review March 25, 2026 22:57
@RobertZ2011 RobertZ2011 requested a review from a team as a code owner March 25, 2026 22:57
Copilot AI review requested due to automatic review settings March 25, 2026 22:57
@RobertZ2011 RobertZ2011 requested a review from a team as a code owner March 25, 2026 22:57
@RobertZ2011 RobertZ2011 requested review from asasine, chchongmsft, gjpmsft, jerrysxie, kurtjd, seanbrns, thdesil and tullom and removed request for Copilot March 25, 2026 22:57
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.

2 participants