Only use output struct values when actually generated#3530
Only use output struct values when actually generated#3530istio-merge-robot merged 2 commits intoistio:masterfrom
Conversation
a7cc247 to
07a37d2
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: geeknoid The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
| func(name string) (value interface{}, found bool) { | ||
| field := strings.TrimPrefix(name, fullOutName) | ||
| if len(field) != len(name) { | ||
| if len(field) != len(name) && out.WasSet(field) { |
There was a problem hiding this comment.
Can you make the same change to the runtime2 bindings below? Around line 547 or so I believe.
| func TestExternEmptyStringMap(t *testing.T) { | ||
| m := externEmptyStringMap() | ||
| if len(m) != 0 { | ||
| t.Errorf("emptyStringMap() returned non-empty map: %#v", m) |
There was a problem hiding this comment.
Can you also add a test to pkg/il/testing/tests.go?
|
/test all [submit-queue is verifying that this PR is safe to merge] |
|
Automatic merge from submit-queue. |
|
@ozevren this PR merged at light-speed. I was halfway through implementing the requested tests and BOOM! it was merged. Amazing. I'll send a follow-up PR. I did notice something in testing however. It appears that externs must always appear in the right-most position of an expression to work as expected. To clarify, for the expression:
I would expect that the result would be What I observed instead, however, was the result was whatever was specified in Checking the generated IL, I saw something like: Is that WAI? It seems like a potential bug. |
it's the new vendor submodule :-) |
This PR is an approach to improving data quality for data generated by preprocess
adapters. The PR updates the generated code for Output structs for preprocess adapters
by adding SetXXXX() methods to the Output type that keep track of attributes that
were set. The generated code that checks for attribute values then also checks to see
if an attribute value was set.
In support of those changes, this PR adds a new expr Fn to Mixer:
emptyStringMap(). Thisnew expr allows creation of default values for string_map expressions.
Finally, the PR updates the various config components for kubernetesenv adapters throughout
the repo.
This should eliminate the
source.service == ""data issues that appeared when the new preprocessoradapter mechanisms were put in place (as well as other zero-value related issues).