fix(storage/fs): various fixes and base test cases #3877
Merged
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 fixes are few things which did not work after the first pass moving eval snapshots into the existing fs/snapshot code.
There were a few missing fields on various types:
I added a bunch of simply baseline unit tests which surfaced all of these things and then I fixed them in this PR.
Here is what the robots said:
internal/storage/fs/snapshot.go
: Initialized theNamespaces
field inevaluation.EvaluationSnapshot
within theEmptySnapshot
function.internal/storage/fs/snapshot.go
: AddedevalSnapFlag
to theFlags
slice in theaddDoc
function.internal/storage/fs/snapshot.go
: Included theDescription
field incore.Rollout
within theaddDoc
function.internal/storage/fs/snapshot.go
: Set theValue
field inevaluation.EvaluationRolloutSegment
within theaddDoc
function.internal/storage/fs/snapshot.go
: AddedevalSnapRollout
to theRollouts
slice inevalSnapFlag
within theaddDoc
function.Improved error handling:
internal/storage/fs/snapshot.go
: Added a check for namespace existence in theGetEvaluationDistributions
function, returning an error if the namespace is not found.Updates to test data:
internal/storage/fs/testdata/empty/features.yml
: Added a namespace key to the empty features test data.internal/storage/fs/testdata/production/features.yaml
: Added detailed production features including flags, variants, rules, and segments.