follow-up: cancel health checks when a resource is not running #6461
+144
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, we only cancel health checks when the
ResourceHealthCheckService
is stopped. We should instead start to run health checks on a resource whenever it gets into theRunning
state and stop running them when they are no longerRunning
.I created a linked cancellation token to represent the lifecycle of an individual resource's periodical health check runs. It is added when the resource is determined to be
Running
, and it is cancelled (and health reports' statuses are set to null) when the resource is not.Additionally, adds several more health check tests for different scenarios, including that reports are updated where the health status did not change but a report status did, and re-enables
ResourcesWithHealthCheck_NotHealthyUntilCheckSucceeds
and so fixes #6385Fixes #6450
Checklist
<remarks />
and<code />
elements on your triple slash comments?Microsoft Reviewers: Open in CodeFlow