fix(datastore): fix NoIndex for array property#7674
Merged
bhshkh merged 7 commits intogoogleapis:mainfrom Aug 8, 2023
Merged
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
631d389 to
79c74f6
Compare
When converting proto to Entity with array property, excludeFromIndexes appears in the values level, not the top level.
6df785f to
bb7a332
Compare
bhshkh
approved these changes
Jun 14, 2023
bhshkh
requested changes
Jul 31, 2023
datastore/load_test.go
Outdated
Comment on lines
+656
to
+658
| if !testutil.Equal(want, dst) { | ||
| t.Errorf("NoIndex should be correct: compare:\ngot: %#v\nwant: %#v", dst, want) | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| if !testutil.Equal(want, dst) { | |
| t.Errorf("NoIndex should be correct: compare:\ngot: %#v\nwant: %#v", dst, want) | |
| } | |
| cmpProperties := func(p1, p2 Property) bool { | |
| return p1.Name < p2.Name | |
| } | |
| if !testutil.Equal(want.Properties, dst.Properties, cmpopts.SortSlices(cmpProperties)) { | |
| t.Errorf("NoIndex should be correct: Property:\ngot: %#v\nwant: %#v", dst, want) | |
| } | |
| if !testutil.Equal(want.Key, dst.Key) { | |
| t.Errorf("NoIndex should be correct: Key:\ngot: %#v\nwant: %#v", dst, want) | |
| } |
| } | ||
| } | ||
|
|
||
| func TestLoadArrayIndex(t *testing.T) { |
Contributor
There was a problem hiding this comment.
This fails intermittently with error:
=== RUN TestLoadArrayIndex
load_test.go:657: NoIndex should be correct: compare:
got: &datastore.Entity{Key:(*datastore.Key)(0xc0005457c0), Properties:[]datastore.Property{datastore.Property{Name:"non-indexed", Value:[]interface {}{"3", "4"}, NoIndex:true}, datastore.Property{Name:"indexed", Value:[]interface {}{"1", "2"}, NoIndex:false}}}
want: &datastore.Entity{Key:(*datastore.Key)(0xc0004b1b80), Properties:[]datastore.Property{datastore.Property{Name:"indexed", Value:[]interface {}{"1", "2"}, NoIndex:false}, datastore.Property{Name:"non-indexed", Value:[]interface {}{"3", "4"}, NoIndex:true}}}
--- FAIL: TestLoadArrayIndex (0.00s)
Please see suggested changes.
Contributor
Author
There was a problem hiding this comment.
thanks for the suggestion.
auto-merge was automatically disabled
August 2, 2023 01:16
Head branch was pushed to by a user without write access
bhshkh
approved these changes
Aug 3, 2023
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.
When converting proto to Entity with array property, ExcludeFromIndexes appears in the values level, not the top level.