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

Add coverage for Route controller failure paths. #1508

Merged
merged 1 commit into from
Jul 6, 2018

Conversation

mattmoor
Copy link
Member

@mattmoor mattmoor commented Jul 6, 2018

This introduces new functionality to our TableTest to enable a Row to provide clientgotesting.ReactionFuncs to induce failures during API requests through the fake clients. For example:

    // Induce a failure creating revisions.
    WantErr: true,
    WithReactors: []clientgotesting.ReactionFunc{
        InduceFailure("create", "revisions"),
    },

Fixes: #1501

@google-prow-robot google-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 6, 2018
@google-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor

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

@google-prow-robot google-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 6, 2018
@mattmoor mattmoor force-pushed the unstable-reactor branch from b67f92a to 584db70 Compare July 6, 2018 17:30
@google-prow-robot google-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 6, 2018
@mattmoor mattmoor changed the title [WIP] Proof of Concept for #1501 Add coverage for Route controller failure paths. Jul 6, 2018
@google-prow-robot google-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 6, 2018
clientgotesting "k8s.io/client-go/testing"
)

func InduceFailure(verb, resource string) clientgotesting.ReactionFunc {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add some comments of how to use this?

Copy link
Member Author

Choose a reason for hiding this comment

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

RFAL

@mattmoor mattmoor force-pushed the unstable-reactor branch 2 times, most recently from 49e22ac to 207a31d Compare July 6, 2018 20:02
This introduces new functionality to our `TableTest` to enable a `Row` to provide `clientgotesting.ReactionFunc`s to induce failures during API requests through the fake clients.  For example:

```go
// Induce a failure creating revisions.
WantErr: true,
WithReactors: []clientgotesting.ReactionFunc{
    InduceFailure("create", "revisions"),
},
```

Fixes: knative/serving#1501
@mattmoor mattmoor force-pushed the unstable-reactor branch from 207a31d to 0d02089 Compare July 6, 2018 20:03
@tcnghia
Copy link
Contributor

tcnghia commented Jul 6, 2018

/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 6, 2018
@knative-metrics-robot
Copy link

The following is the coverage report on pkg/. Say /test pull-knative-serving-go-coverage to run the coverage report again

File Old Coverage New Coverage Delta
pkg/controller/route/route.go 95.0% 98.8% 3.8
pkg/controller/route/cruds.go 69.5% 92.6% 23.1

*TestCoverage feature is being tested, do not rely on any info here yet

@tcnghia
Copy link
Contributor

tcnghia commented Jul 6, 2018

route.go 98.8% !

@mattmoor
Copy link
Member Author

mattmoor commented Jul 6, 2018

/test pull-knative-serving-unit-tests

1 similar comment
@mattmoor
Copy link
Member Author

mattmoor commented Jul 6, 2018

/test pull-knative-serving-unit-tests

@google-prow-robot google-prow-robot merged commit a7140e6 into knative:master Jul 6, 2018
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. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants