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

Server errors should not be tainted by client error messages #1406

Merged
merged 4 commits into from
Aug 6, 2021

Conversation

vyasgun
Copy link
Contributor

@vyasgun vyasgun commented Jul 29, 2021

Description

In some cases, if an error is from server but contains a substring that matches a client side error condition, the error returned by the server is being accompanied by the client side error message. This should not be the case.

Changes

  • Moved the server error parsing case up so it gets processed before we breakdown the error string for client level message.
  • Added test cases.

Reference

Fixes #1342

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 29, 2021
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@vyasgun: 0 warnings.

In response to this:

Description

In some cases, if an error is from server but contains a substring that matches a client side error condition, the error returned by the server is being accompanied by the client side error message. This should not be the case.

Changes

  • Moved the server error parsing case up so it gets processed before we breakdown the error string for client level message.
  • Added test cases.

Reference

Fixes #1342

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.

@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 29, 2021
@codecov
Copy link

codecov bot commented Jul 29, 2021

Codecov Report

Merging #1406 (b03fa3e) into main (712e0e4) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1406      +/-   ##
==========================================
+ Coverage   78.33%   78.35%   +0.02%     
==========================================
  Files         160      160              
  Lines        8270     8274       +4     
==========================================
+ Hits         6478     6483       +5     
  Misses       1103     1103              
+ Partials      689      688       -1     
Impacted Files Coverage Δ
pkg/errors/factory.go 96.87% <100.00%> (+4.01%) ⬆️

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 712e0e4...b03fa3e. Read the comment docs.

@vyasgun vyasgun changed the title Server errors should not be tainted by client error Server errors should not be tainted by client error messages Jul 29, 2021
pkg/errors/factory.go Outdated Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 29, 2021
Copy link
Contributor

@dsimansk dsimansk left a comment

Choose a reason for hiding this comment

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

Please add a changelog entry. Sorry I haven't noticed sooner. :)

@vyasgun
Copy link
Contributor Author

vyasgun commented Jul 29, 2021

@dsimansk sorry I keep forgetting about adding the entry 😆

@dsimansk
Copy link
Contributor

@dsimansk sorry I keep forgetting about adding the entry laughing

Well, it happens to me all the time. :)

@dsimansk
Copy link
Contributor

dsimansk commented Jul 29, 2021

Thanks looks good to me. I'll leave it open for a while for other to take a look.

/approve

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2021
Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

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

Left a few comments and questions. Thanks for the contribution.

pkg/errors/factory.go Show resolved Hide resolved
Name: "not internal error",
Error: mockErrType{},
Internal: false,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

What about unknown errors? Or the previous covers it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous function covers the non k8s api errors. This one covers a mock one which implements the k8s api interface.

Copy link
Contributor

Choose a reason for hiding this comment

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

@maximilien any more comments to the above please?

@knative-metrics-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/errors/factory.go 96.2% 96.6% 0.4

@vyasgun vyasgun requested a review from dsimansk August 2, 2021 17:39
@vyasgun
Copy link
Contributor Author

vyasgun commented Aug 2, 2021

/retest

@dsimansk
Copy link
Contributor

dsimansk commented Aug 6, 2021

As I don't see any new comments, I'd say it's done. :)

Thanks @vyasgun!
/approve
/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 6, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dsimansk, vyasgun

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vyasgun
Copy link
Contributor Author

vyasgun commented Aug 6, 2021

/retest

@dsimansk
Copy link
Contributor

dsimansk commented Aug 6, 2021

/retest

@knative-prow-robot knative-prow-robot merged commit 8eda0e0 into knative:main Aug 6, 2021
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
Development

Successfully merging this pull request may close these issues.

kn is presenting API server errors incorrectly
5 participants