diff --git a/pkg/api/bindings.go b/pkg/api/bindings.go index 7e9b838..871e449 100644 --- a/pkg/api/bindings.go +++ b/pkg/api/bindings.go @@ -98,6 +98,7 @@ func AsCloudEvent(event CDEventReader) (*cloudevents.Event, error) { return nil, fmt.Errorf("cannot validate CDEvent %v", err) } ce := cloudevents.NewEvent() + ce.SetID(event.GetId()) ce.SetSource(event.GetSource()) ce.SetSubject(event.GetSubjectId()) ce.SetType(event.GetType().String()) diff --git a/pkg/api/bindings_test.go b/pkg/api/bindings_test.go index e882cb3..0bc51d7 100644 --- a/pkg/api/bindings_test.go +++ b/pkg/api/bindings_test.go @@ -116,6 +116,9 @@ func TestAsCloudEvent(t *testing.T) { if err != nil { t.Fatalf("didn't expected it to fail, but it did: %v", err) } + if d := cmp.Diff(tc.event.GetId(), ce.Context.GetID()); d != "" { + t.Errorf("args: diff(-want,+got):\n%s", d) + } if d := cmp.Diff(testSubjectId, ce.Context.GetSubject()); d != "" { t.Errorf("args: diff(-want,+got):\n%s", d) }