-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Remove invalid conditions from persistent tests #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -572,72 +572,10 @@ func (s *ServerSidePersistentTests) Run(t *ldtest.T) { | |
|
|
||
| require.NoError(t, s.persistentStore.WriteMap(s.defaultPrefix, "features", s.initialFlags)) | ||
|
|
||
| if cacheConfig.Mode == servicedef.CacheModeInfinite { | ||
| // This key was already cached, so it shouldn't see the change above. | ||
| h.RequireNever(t, | ||
| checkForUpdatedValue(t, client, "flag-key", context, | ||
| ldvalue.String("value"), ldvalue.String("new-value"), ldvalue.String("default")), | ||
| time.Millisecond*500, time.Millisecond*20, "flag-key was incorrectly updated") | ||
|
|
||
| // But since we didn't evaluate this flag, this should actually be | ||
| // reflected by directly changing the database. | ||
| h.RequireEventually(t, | ||
| checkForUpdatedValue(t, client, "uncached-flag-key", context, | ||
| ldvalue.String("default"), ldvalue.String("fallthrough"), ldvalue.String("default")), | ||
| time.Millisecond*500, time.Millisecond*20, "uncached-flag-key was incorrectly cached") | ||
| } else if cacheConfig.Mode == servicedef.CacheModeTTL { | ||
| // This key was already cached, so it shouldn't see the change above. | ||
| h.RequireNever(t, | ||
| checkForUpdatedValue(t, client, "flag-key", context, | ||
| ldvalue.String("value"), ldvalue.String("new-value"), ldvalue.String("default")), | ||
| time.Duration( | ||
| int(time.Second)*cacheConfig.TTL.Value()/2), | ||
| time.Millisecond*20, | ||
| "flag-key was incorrectly updated") | ||
|
|
||
| // But eventually, it will expire and then we will fetch it from the database. | ||
| h.RequireEventually(t, | ||
| checkForUpdatedValue(t, client, "flag-key", context, | ||
| ldvalue.String("value"), ldvalue.String("fallthrough"), ldvalue.String("default")), | ||
| time.Duration(int(time.Second)*cacheConfig.TTL.Value()), time.Millisecond*20, "flag-key was incorrectly cached") | ||
| } | ||
| }) | ||
|
|
||
| s.runWithEmptyStore(t, "ignores dropped flags", func(t *ldtest.T) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is redundant with the check above. Whether I delete flags or change them, it is confirming the same thing. |
||
| persistence := NewPersistence() | ||
| persistence.SetStoreMode(servicedef.DataStoreModeReadWrite) | ||
| persistence.SetStore(servicedef.SDKConfigPersistentStore{ | ||
| Type: s.persistentStore.Type(), | ||
| DSN: s.persistentStore.DSN(), | ||
| }) | ||
| persistence.SetCache(cacheConfig) | ||
|
|
||
| sdkData := s.makeSDKDataWithFlag(1, ldvalue.String("value")) | ||
| _, configurers := s.setupDataSystems(t, sdkData) | ||
| configurers = append(configurers, persistence) | ||
|
|
||
| client := NewSDKClient(t, s.baseSDKConfigurationPlus(configurers...)...) | ||
| context := ldcontext.New("user-key") | ||
| s.eventuallyRequireDataStoreInit(t, s.defaultPrefix) | ||
|
|
||
| pollUntilFlagValueUpdated(t, client, "flag-key", context, | ||
| ldvalue.String("default"), ldvalue.String("value"), ldvalue.String("default")) | ||
|
|
||
| require.NoError(t, s.persistentStore.Reset()) | ||
|
|
||
| // This key was already cached, so it shouldn't see the change above. | ||
| h.RequireNever(t, | ||
| checkForUpdatedValue(t, client, "flag-key", context, | ||
| ldvalue.String("value"), ldvalue.String("default"), ldvalue.String("default")), | ||
| time.Millisecond*500, time.Millisecond*20, "flag was never updated") | ||
|
|
||
| if cacheConfig.Mode == servicedef.CacheModeTTL { | ||
| // But eventually, it will expire and then we will fetch it from the database. | ||
| h.RequireEventually(t, | ||
| checkForUpdatedValue(t, client, "flag-key", context, | ||
| ldvalue.String("value"), ldvalue.String("default"), ldvalue.String("default")), | ||
| time.Second, time.Millisecond*20, "flag-key was incorrectly cached") | ||
| } | ||
| ldvalue.String("value"), ldvalue.String("new-value"), ldvalue.String("default")), | ||
| time.Millisecond*500, time.Millisecond*20, "flag-key was incorrectly updated") | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff looks weird, but basically the first two if / else if blocks are reduced to this single check.
In FDv2, if the data system has a data source that has provided data, we never rely on the persistent store again. As a result, the "But since ..." checks weren't valid.