-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(datastore): fix NoIndex for array property #7674
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
datastore/load_test.go
Outdated
if !testutil.Equal(want, dst) { | ||
t.Errorf("NoIndex should be correct: compare:\ngot: %#v\nwant: %#v", dst, want) | ||
} |
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.
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) | |
} |
@@ -602,6 +602,62 @@ func TestTimezone(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestLoadArrayIndex(t *testing.T) { |
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.
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.
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.
thanks for the suggestion.
Head branch was pushed to by a user without write access
When converting proto to Entity with array property, ExcludeFromIndexes appears in the values level, not the top level.