Ensure kv collection refresh settings are not considered unless the feature is enabled.#633
Merged
Merged
Conversation
…ion based refresh of key-values is enabled. Add tests to ensure that minimum refresh interval is respected for key-values and feature flags.
Contributor
There was a problem hiding this comment.
PR Overview
This PR ensures that the key-value collection refresh interval is only applied when collection‑based refresh is enabled and adds tests to verify that both key-value and feature flag refresh intervals are respected.
- Added tests to confirm that the refresh interval for a single key and feature flags is enforced.
- Updated the refresh logic in the provider to check that kv collection refresh settings are only used when RegisterAll is enabled.
- Added a precondition check to throw an exception when an invalid KvCollectionRefreshInterval is provided.
Reviewed Changes
| File | Description |
|---|---|
| tests/Tests.AzureAppConfiguration/RefreshTests.cs | Added tests for ensuring minimum refresh intervals and verifying that refresh calls behave as expected. |
| src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureAppConfigurationProvider.cs | Updated refresh logic to consider RegisterAllEnabled and introduced a validation check for KvCollectionRefreshInterval. |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureAppConfigurationProvider.cs:121
- [nitpick] Consider enhancing the exception message to more explicitly state that the KvCollectionRefreshInterval is only applicable when using RegisterAll enabled mode.
if (options.KvCollectionRefreshInterval <= TimeSpan.Zero)
Member
Author
|
@amerjusupovic it looks like the tests i added already existed. I removed them. But I noticed that tests were using Thread.Sleep, I replaced them with Task.Delay. |
amerjusupovic
approved these changes
Mar 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR does the following:
Impact wise, these changes should have little to no behavioral/performance impact. Mostly code clarity.
In response to #632