Update refresh scenario tests - #205
Merged
Merged
Conversation
Avani Gupta (avanigupta)
requested review from
AA (abhilasharora) and
Jimmy Campbell (jimmyca15)
October 12, 2020 20:04
Contributor
AA (abhilasharora)
approved these changes
Oct 13, 2020
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.
I found that some refresh scenario tests were actually not testing the intended functionality because of the following reasons:
We were selecting/registering KVs based on just key name, whereas all the KVs in mock data also had a label. That led to unintentionally registering/selecting non-existent keys with null labels, and hence the test took a different code path than expected.
For Eg:
When
RefreshAsynccall triggersRefreshIndividualKeyValues, instead of callingGetKeyValueChangeand processing the "changes", we load the setting again withGetConfigurationSettingAsync. That misses the intention of testing theGetKeyValueChangemethod.When
LoadKeyValuesRegisteredForRefreshis called, we should skip loading KV that have already loaded as part ofSelectclause. But since we registered a KV without its label, it's treated as a new KV and loaded again.We were always returning the entire mock data collection of KV, regardless of what is present in the
Selectclause. This led to unintentional behavior in tests likeRefreshTests_RefreshRegisteredKeysAreLoadedOnStartup_DefaultUseQueryandRefreshTests_RefreshRegisteredKeysAreLoadedOnStartup_CustomUseQuery. These tests would always pass regardless ofConfigureRefreshbecause theSelectclause (or a lack thereof), ensures that all KVs from mock data collection are loaded.To fix this, I have made the following changes to these tests:
GetConfigurationSettingAsync(ConfigurationSetting setting, bool cond, CancellationToken ct)method inGetMockConfigurationClient().GetMockConfigurationClient()method.Originally posted by Avani Gupta (@avanigupta) in #204 (comment)