-
Notifications
You must be signed in to change notification settings - Fork 117
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 binary events with no data and ce overrides not being delivered #3475
Fix binary events with no data and ce overrides not being delivered #3475
Conversation
Signed-off-by: Calum Murray <cmurray@redhat.com>
/cc @pierDipi |
/hold |
/cherry-pick release-1.12 |
@Cali0707: once the present PR merges, I will cherry-pick it on top of release-1.12 in a new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3475 +/- ##
============================================
+ Coverage 58.46% 63.04% +4.58%
- Complexity 0 839 +839
============================================
Files 91 182 +91
Lines 9338 12452 +3114
Branches 0 268 +268
============================================
+ Hits 5459 7850 +2391
- Misses 3443 4000 +557
- Partials 436 602 +166
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
/cherry-pick release-v1.11 |
@Cali0707: once the present PR merges, I will cherry-pick it on top of release-v1.11 in a new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: Calum Murray <cmurray@redhat.com>
/unhold |
Signed-off-by: Calum Murray <cmurray@redhat.com>
/test reconciler-tests-namespaced-broker |
1 similar comment
/test reconciler-tests-namespaced-broker |
/cc @matzew |
The bug can be seen with the test failure from before I pushed the fix here The test is now passing with the fix |
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.
Can we add a few unit test as well?
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.
A good scenario to test is a chain RecordDispatcherMutatorChain
similar to the one we use in reality
final var recordDispatcher = new RecordDispatcherMutatorChain(
new RecordDispatcherImpl(
consumerVerticleContext,
getFilter(),
egressSubscriberSender,
egressDeadLetterSender,
responseHandler,
offsetManager,
ConsumerTracer.create(
((VertxInternal) vertx).tracer(),
consumerVerticleContext.getConsumerConfigs(),
TracingPolicy.PROPAGATE),
Metrics.getRegistry()),
new CloudEventOverridesMutator(
consumerVerticleContext.getResource().getCloudEventOverrides()));
passing an InvalidCloudEvent
object
private CloudEvent maybeDeserializeFromHeaders(ConsumerRecord<Object, CloudEvent> record) { | ||
if (record.value() != null) { | ||
return record.value(); | ||
} | ||
// A valid CloudEvent in the CE binary protocol binding of Kafka | ||
// might be composed by only Headers. | ||
// | ||
// KafkaConsumer doesn't call the deserializer if the value | ||
// is null. | ||
// | ||
// That means that we get a record with a null value and some CE | ||
// headers even though the record is a valid CloudEvent. | ||
return cloudEventDeserializer.deserialize(record.topic(), record.headers(), null); | ||
} |
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 logic is duplicated from RecordDispatcherImpl
, can we extract a common method, usable by both CloudEventOverridesMutator
and RecordDispatcherImpl
Signed-off-by: Calum Murray <cmurray@redhat.com>
Signed-off-by: Calum Murray <cmurray@redhat.com>
/cc @pierDipi I've added unit tests now, and fixed the order of the interceptors (you were correct) |
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.
/lgtm
/approve
Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Cali0707, pierDipi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest-required |
/test reconciler-tests |
1 similar comment
/test reconciler-tests |
/retest-required |
/test reconciler-tests-namespaced-broker |
@Cali0707: new pull request created: #3579 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@Cali0707: new pull request created: #3580 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@Cali0707: cannot checkout In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cherry-pick release-1.11 |
@Cali0707: new pull request could not be created: failed to create pull request against knative-extensions/eventing-kafka-broker#release-1.11 from head knative-prow-robot:cherry-pick-3475-to-release-1.11: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for knative-prow-robot:cherry-pick-3475-to-release-1.11."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request"} In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
…native-extensions#3475) * Added regression test for binary events with extensions Signed-off-by: Calum Murray <cmurray@redhat.com> * deserialize the event from the headers if the record value is null Signed-off-by: Calum Murray <cmurray@redhat.com> * update codegen Signed-off-by: Calum Murray <cmurray@redhat.com> * use an interceptor instead of handling it in the mutatorchain Signed-off-by: Calum Murray <cmurray@redhat.com> * added unit test for interceptor chain Signed-off-by: Calum Murray <cmurray@redhat.com> * fixed order of interceptors Signed-off-by: Calum Murray <cmurray@redhat.com> --------- Signed-off-by: Calum Murray <cmurray@redhat.com>
…native-extensions#3475) * Added regression test for binary events with extensions Signed-off-by: Calum Murray <cmurray@redhat.com> * deserialize the event from the headers if the record value is null Signed-off-by: Calum Murray <cmurray@redhat.com> * update codegen Signed-off-by: Calum Murray <cmurray@redhat.com> * use an interceptor instead of handling it in the mutatorchain Signed-off-by: Calum Murray <cmurray@redhat.com> * added unit test for interceptor chain Signed-off-by: Calum Murray <cmurray@redhat.com> * fixed order of interceptors Signed-off-by: Calum Murray <cmurray@redhat.com> --------- Signed-off-by: Calum Murray <cmurray@redhat.com>
…ing delivered (#3475) (#3595) * Fix binary events with no data and ce overrides not being delivered (#3475) * Added regression test for binary events with extensions Signed-off-by: Calum Murray <cmurray@redhat.com> * deserialize the event from the headers if the record value is null Signed-off-by: Calum Murray <cmurray@redhat.com> * update codegen Signed-off-by: Calum Murray <cmurray@redhat.com> * use an interceptor instead of handling it in the mutatorchain Signed-off-by: Calum Murray <cmurray@redhat.com> * added unit test for interceptor chain Signed-off-by: Calum Murray <cmurray@redhat.com> * fixed order of interceptors Signed-off-by: Calum Murray <cmurray@redhat.com> --------- Signed-off-by: Calum Murray <cmurray@redhat.com> * fix InterceptorChainTest build issues Signed-off-by: Calum Murray <cmurray@redhat.com> --------- Signed-off-by: Calum Murray <cmurray@redhat.com>
…native-extensions#3475) * Added regression test for binary events with extensions Signed-off-by: Calum Murray <cmurray@redhat.com> * deserialize the event from the headers if the record value is null Signed-off-by: Calum Murray <cmurray@redhat.com> * update codegen Signed-off-by: Calum Murray <cmurray@redhat.com> * use an interceptor instead of handling it in the mutatorchain Signed-off-by: Calum Murray <cmurray@redhat.com> * added unit test for interceptor chain Signed-off-by: Calum Murray <cmurray@redhat.com> * fixed order of interceptors Signed-off-by: Calum Murray <cmurray@redhat.com> --------- Signed-off-by: Calum Murray <cmurray@redhat.com>
…native-extensions#3475) * Added regression test for binary events with extensions Signed-off-by: Calum Murray <cmurray@redhat.com> * deserialize the event from the headers if the record value is null Signed-off-by: Calum Murray <cmurray@redhat.com> * update codegen Signed-off-by: Calum Murray <cmurray@redhat.com> * use an interceptor instead of handling it in the mutatorchain Signed-off-by: Calum Murray <cmurray@redhat.com> * added unit test for interceptor chain Signed-off-by: Calum Murray <cmurray@redhat.com> * fixed order of interceptors Signed-off-by: Calum Murray <cmurray@redhat.com> --------- Signed-off-by: Calum Murray <cmurray@redhat.com>
…eing delivered (#972) * Fix binary events with no data and ce overrides not being delivered (knative-extensions#3475) * Added regression test for binary events with extensions Signed-off-by: Calum Murray <cmurray@redhat.com> * deserialize the event from the headers if the record value is null Signed-off-by: Calum Murray <cmurray@redhat.com> * update codegen Signed-off-by: Calum Murray <cmurray@redhat.com> * use an interceptor instead of handling it in the mutatorchain Signed-off-by: Calum Murray <cmurray@redhat.com> * added unit test for interceptor chain Signed-off-by: Calum Murray <cmurray@redhat.com> * fixed order of interceptors Signed-off-by: Calum Murray <cmurray@redhat.com> --------- Signed-off-by: Calum Murray <cmurray@redhat.com> * fix: make InterceptorChain class static to fix compiler error Signed-off-by: Calum Murray <cmurray@redhat.com> --------- Signed-off-by: Calum Murray <cmurray@redhat.com>
Fixes bug where binary events with ce overrides don't get delivered
Proposed Changes
Release Note
Docs