Skip to content

Commit

Permalink
Set input bag during apa (istio#3687)
Browse files Browse the repository at this point in the history
  • Loading branch information
ozevren authored and geeknoid committed Feb 22, 2018
1 parent d939140 commit 15071de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions mixer/pkg/runtime2/dispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ func (d *Dispatcher) dispatch(session *session) error {
state.instance = instance
if session.variety == tpb.TEMPLATE_VARIETY_ATTRIBUTE_GENERATOR {
state.mapper = group.Mappers[j]
state.inputBag = session.bag
}

// Dispatch for singleton dispatches
Expand Down
8 changes: 8 additions & 0 deletions mixer/pkg/runtime2/dispatcher/dispatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ ident : dest.istio-system
'
[tapa] InstanceBuilderFn() <= (SUCCESS)
[tapa] DispatchGenAttrs => instance: '&Empty{}'
[tapa] DispatchGenAttrs => attrs: '---
ident : dest.istio-system
'
[tapa] DispatchGenAttrs => mapper(exists): 'true'
[tapa] DispatchGenAttrs <= (SUCCESS)
`,
},
Expand Down Expand Up @@ -443,6 +447,10 @@ ident : dest.istio-system
'
[tapa] InstanceBuilderFn() <= (SUCCESS)
[tapa] DispatchGenAttrs => instance: '&Empty{}'
[tapa] DispatchGenAttrs => attrs: '---
ident : dest.istio-system
'
[tapa] DispatchGenAttrs => mapper(exists): 'true'
[tapa] DispatchGenAttrs <= (ERROR)
`,
Expand Down
2 changes: 2 additions & 0 deletions mixer/pkg/runtime2/testing/data/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ func createFakeTemplate(name string, s FakeTemplateSettings, l *Logger, variety
DispatchGenAttrs: func(ctx context.Context, handler adapter.Handler, instance interface{},
attrs attribute.Bag, mapper template.OutputMapperFn) (*attribute.MutableBag, error) {
l.writeFormat(name, "DispatchGenAttrs => instance: '%+v'", instance)
l.writeFormat(name, "DispatchGenAttrs => attrs: '%+v'", attrs.DebugString())
l.writeFormat(name, "DispatchGenAttrs => mapper(exists): '%+v'", mapper != nil)

signalCallAndWait(s)

Expand Down

0 comments on commit 15071de

Please sign in to comment.