Skip to content

return unexpected apply traffic error - #8285

Merged
knative-prow-robot merged 5 commits into
knative:masterfrom
runzexia:apply-traffic-unexpect-error
Jul 7, 2020
Merged

knative-prow-robot merged 5 commits into
knative:masterfrom
runzexia:apply-traffic-unexpect-error

Conversation

@runzexia

Copy link
Copy Markdown
Contributor

Signed-off-by: RyderXia [email protected]

Fix could not get unexpected error in applySpecTraffic

@googlebot

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no Indicates the PR's author has not signed the CLA. label Jun 10, 2020
@knative-prow-robot knative-prow-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 10, 2020

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@runzexia: 0 warnings.

Details

In response to this:

Signed-off-by: RyderXia [email protected]

Fix could not get unexpected error in applySpecTraffic

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

Copy link
Copy Markdown
Contributor

Welcome @runzexia! It looks like this is your first PR to knative/serving 🎉

@knative-prow-robot

Copy link
Copy Markdown
Contributor

Hi @runzexia. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@vagababov

Copy link
Copy Markdown
Contributor

/ok-to-test
Needs a test.

@knative-prow-robot knative-prow-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 10, 2020
@nak3

nak3 commented Jun 11, 2020

Copy link
Copy Markdown
Contributor

/lgtm
@runzexia Thank you for your PR. could you please sign the CLA as per #8285 (comment) ?

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 11, 2020
@runzexia

Copy link
Copy Markdown
Contributor Author

@nak3 Yes, I can sign the CLA, which will take some time.

@runzexia

Copy link
Copy Markdown
Contributor Author

@googlebot I fixed it..

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes Indicates the PR's author has signed the CLA. and removed cla: no Indicates the PR's author has not signed the CLA. labels Jun 11, 2020

@shashwathi shashwathi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add an unit test for this case?

@runzexia

runzexia commented Jun 11, 2020 •

Copy link
Copy Markdown
Contributor Author

Can you add an unit test for this case?

@shashwathi
It seems not easy to add an unit test.
NotFound error would handle by builder.build().
I don't know how to inject other errors into the fakeClient. do you have any suggestions?

@vagababov

Copy link
Copy Markdown
Contributor

You can test by passing invalid input, e.g. un ready revision

@runzexia

Copy link
Copy Markdown
Contributor Author

@vagababov
Is un ready revision unreadyRevisionError?
Because these errors are all TargetError, the error will not be returned.
After checking the source code, I found that only the unexpect error when calling kubernetes api will be returned by err, and the rest will be returned by builder.build().
If I have something wrong, please say it😑

@vagababov

Copy link
Copy Markdown
Contributor

you can probably use a revision that does not exist. That would trigger a not found error.

@runzexia

Copy link
Copy Markdown
Contributor Author

Not Found err would be convert to TargetError.

if errors.IsNotFound(err) {
return nil, errMissingConfiguration(name)
} else if err != nil {

if errors.IsNotFound(err) {
return nil, errMissingRevision(name)
} else if err != nil {

Unready error also would be convert to TargetError.
if config.Status.LatestReadyRevisionName == "" {
return errUnreadyConfiguration(config)
}

if !rev.IsReady() {
return errUnreadyRevision(rev)
}

And TargetError would be handle by this

if err, ok := err.(TargetError); err != nil && ok {
// Defer target errors, as we still want to compile a list of
// all referred targets, including missing ones.
t.deferTargetError(err)
return nil
}

I think only

} else if err != nil {
return nil, err
}

and
} else if err != nil {
return nil, err
}
t.revisions[name] = rev

would be return by err.

@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Jun 24, 2020
@googlebot

Copy link
Copy Markdown

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no Indicates the PR's author has not signed the CLA. and removed cla: yes Indicates the PR's author has signed the CLA. labels Jun 24, 2020
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 24, 2020
Comment on lines +932 to +934
t.Errorf("Expected %s, saw %s", apiErr.Error(), err.Error())
} else if err == nil {
t.Errorf("Expected %s, saw no error", apiErr.Error())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Got before want (.e.g err=%s, want: %s).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fix

@runzexia
runzexia requested review from shashwathi and vagababov June 30, 2020 05:20
@runzexia

Copy link
Copy Markdown
Contributor Author

/retest

@nak3

nak3 commented Jun 30, 2020

Copy link
Copy Markdown
Contributor

@googlebot I consent

I guess Google CLA complains because of a3951f4. Let's see my consent comment.

@nak3

nak3 commented Jun 30, 2020

Copy link
Copy Markdown
Contributor

@googlebot I consent.

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes Indicates the PR's author has signed the CLA. and removed cla: no Indicates the PR's author has not signed the CLA. labels Jun 30, 2020
@knative-test-reporter-robot

Copy link
Copy Markdown

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-integration-tests 0/3

Failed non-flaky tests preventing automatic retry of pull-knative-serving-integration-tests:

test/conformance/api/v1.TestRevisionTimeout
test/conformance/ingress.TestIngressConformance
test/conformance/ingress.TestIngressConformance/headers/post-split

@knative-metrics-robot

Copy link
Copy Markdown

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

File Old Coverage New Coverage Delta
pkg/reconciler/route/traffic/traffic.go 93.9% 95.7% 1.8

@vagababov vagababov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 7, 2020
@knative-prow-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: runzexia, vagababov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@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 7, 2020
@knative-prow-robot
knative-prow-robot merged commit eb4574b into knative:master Jul 7, 2020
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. area/API API objects and controllers area/networking cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants