Skip to content
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

Remove double invocations to responseWriter.WriteHeader in filter handler #4466

Merged
merged 5 commits into from
Nov 5, 2020

Conversation

slinkydeveloper
Copy link
Contributor

Signed-off-by: Francesco Guardiani francescoguard@gmail.com

Fixes #4464

Proposed Changes

  • Removed double invocations to responseWriter.WriteHeader in filter handler
  • Testing in filter_handler_test.go if WriteHeader is invoked more than once

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 5, 2020
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 5, 2020
@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2020
@codecov
Copy link

codecov bot commented Nov 5, 2020

Codecov Report

Merging #4466 into master will increase coverage by 0.07%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4466      +/-   ##
==========================================
+ Coverage   81.19%   81.27%   +0.07%     
==========================================
  Files         281      282       +1     
  Lines        7981     8004      +23     
==========================================
+ Hits         6480     6505      +25     
  Misses       1112     1112              
+ Partials      389      387       -2     
Impacted Files Coverage Δ
pkg/mtbroker/filter/filter_handler.go 79.51% <80.00%> (+0.99%) ⬆️
pkg/kncloudevents/message_sender.go 78.00% <0.00%> (-1.67%) ⬇️
pkg/channel/message_dispatcher.go 77.31% <0.00%> (-0.24%) ⬇️
...econciler/inmemorychannel/dispatcher/controller.go 78.26% <0.00%> (ø)
pkg/kncloudevents/http_client.go 100.00% <0.00%> (ø)
...iler/inmemorychannel/dispatcher/inmemorychannel.go 89.39% <0.00%> (+0.86%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7bf5d1c...db64ed6. Read the comment docs.

@tommyreddad
Copy link
Contributor

/assign

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@tommyreddad
Copy link
Contributor

I'm just a bit concerned that some of the error cases which this is intended to fix don't really have coverage. So I'm not sure the extent to which this is fully tested. Still, to my eyes this looks good!

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 5, 2020
@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented Nov 5, 2020

I'm just a bit concerned that some of the error cases which this is intended to fix don't really have coverage. So I'm not sure the extent to which this is fully tested. Still, to my eyes this looks good!

@tommyreddad Can you be more specific on which error case? I can try to cover them all, although the real issue was that the writeResponse method wasn't writing the response in some cases. And in the caller of writeResponse, we were trying anyway to write the headers

/hold

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 5, 2020
@tommyreddad
Copy link
Contributor

I'm just a bit concerned that some of the error cases which this is intended to fix don't really have coverage. So I'm not sure the extent to which this is fully tested. Still, to my eyes this looks good!

@tommyreddad Can you be more specific on which error case? I can try to cover them all, although the real issue was that the writeResponse method wasn't writing the response in some cases. And in the caller of writeResponse, we were trying anyway to write the headers

/hold

Just examining the coverage report, the following cases don't seem covered:

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 5, 2020
@slinkydeveloper
Copy link
Contributor Author

@tommyreddad I covered only the case 1, the case 2 is infallible and for the case 3 failure is very hard to simulate (a failure that comes to my mind is a broken i/o pipe to simulate), not really worth it. I think now we're well covered

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 5, 2020
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
pkg/mtbroker/filter/filter_handler.go Outdated Show resolved Hide resolved
pkg/mtbroker/filter/filter_handler.go Outdated Show resolved Hide resolved
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Copy link
Member

@pierDipi pierDipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 5, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pierDipi, slinkydeveloper

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:
  • OWNERS [pierDipi,slinkydeveloper]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/mtbroker/filter/filter_handler.go 87.1% 87.2% 0.1

@matzew
Copy link
Member

matzew commented Nov 5, 2020

little bit late w/ the reviews, but most has been covered already

LGTM

@knative-prow-robot knative-prow-robot merged commit a6fc540 into knative:master Nov 5, 2020
@slinkydeveloper slinkydeveloper deleted the issues/4464 branch November 5, 2020 17:35
@slinkydeveloper
Copy link
Contributor Author

Porting to 0.17 and 0.18

slinkydeveloper added a commit to slinkydeveloper/eventing that referenced this pull request Nov 5, 2020
…dler (knative#4466)

* Fix knative#4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
slinkydeveloper added a commit to slinkydeveloper/eventing that referenced this pull request Nov 5, 2020
…dler (knative#4466)

* Fix knative#4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
slinkydeveloper added a commit to slinkydeveloper/eventing that referenced this pull request Nov 5, 2020
…dler (knative#4466)

* Fix knative#4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@slinkydeveloper
Copy link
Contributor Author

0.17 port: #4470
0.18 port: #4471

matzew pushed a commit to matzew/eventing that referenced this pull request Nov 5, 2020
…dler (knative#4466)

* Fix knative#4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
knative-prow-robot pushed a commit that referenced this pull request Nov 5, 2020
* Remove double invocations to responseWriter.WriteHeader in filter handler (#4466)

* Fix #4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
knative-prow-robot pushed a commit that referenced this pull request Nov 5, 2020
* Remove double invocations to responseWriter.WriteHeader in filter handler (#4466)

* Fix #4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
openshift-merge-robot pushed a commit to openshift/knative-eventing that referenced this pull request Nov 5, 2020
* Remove double invocations to responseWriter.WriteHeader in filter handler (knative#4466)

* Fix knative#4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

Co-authored-by: slinkydeveloper <francescoguard@gmail.com>
matzew pushed a commit to matzew/eventing that referenced this pull request Nov 7, 2020
* Remove double invocations to responseWriter.WriteHeader in filter handler (knative#4466)

* Fix knative#4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
matzew pushed a commit to openshift/knative-eventing that referenced this pull request Nov 7, 2020
* Remove double invocations to responseWriter.WriteHeader in filter handler (knative#4466)

* Fix knative#4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
openshift-merge-robot pushed a commit to openshift/knative-eventing that referenced this pull request Nov 7, 2020
* Update pingsource-mt-adapter.yaml

* Like on 0.18.3, we skip the tracing tests

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* [release-0.18] Retry on network failures (knative#4454) (knative#4457)

* Retry on network failures (knative#4454)

Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>

* nethttp -> http

Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>

* Backport knative#4465 (knative#4468)

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* [0.18] Backport knative#4466 (knative#4471)

* Remove double invocations to responseWriter.WriteHeader in filter handler (knative#4466)

* Fix knative#4464

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Docs

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Moar tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Linting

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit with metrics

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

(cherry picked from commit a6fc540)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Nit

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* fixed wrong marshall in apiserversouece which will fix the missing ceOverrides extension  (knative#4477) (knative#4480)

* fixed wrong marshall

* fixed UT

* [0.18] Readyness probe in broker ingress (knative#4483)

* Fix knative#4473

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Massage the filter yaml

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

Co-authored-by: Matthias Wessendorf <mwessend@redhat.com>
Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
Co-authored-by: Francesco Guardiani <francescoguard@gmail.com>
Co-authored-by: capri-xiyue <52932582+capri-xiyue@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
6 participants