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

Leverage "Reactors" to better cover failure paths. #1501

Closed
mattmoor opened this issue Jul 5, 2018 · 6 comments
Closed

Leverage "Reactors" to better cover failure paths. #1501

mattmoor opened this issue Jul 5, 2018 · 6 comments
Assignees
Labels
area/API API objects and controllers area/test-and-release It flags unit/e2e/conformance/perf test issues for product features

Comments

@mattmoor
Copy link
Member

mattmoor commented Jul 5, 2018

Reactors let you register a ReactionFunc callback that intercepts requests make through the K8s fake clients. We should be able to use them to insert request failures along paths through Reconcile that wouldn't otherwise fail.

I'd like to come up with a neat little extension to TableTest that enables us to drive our coverage up even further, since failure paths are a significant blind spot in our current coverage.

@google-prow-robot google-prow-robot added area/API API objects and controllers area/test-and-release It flags unit/e2e/conformance/perf test issues for product features labels Jul 5, 2018
@mattmoor
Copy link
Member Author

mattmoor commented Jul 5, 2018

cc @tcnghia

@mattmoor
Copy link
Member Author

mattmoor commented Jul 5, 2018

cc @jonjohnsonjr

@jonjohnsonjr
Copy link
Contributor

Neato

@mattmoor
Copy link
Member Author

mattmoor commented Jul 6, 2018

I'm thinking that we should augment TableTest's rows with a WithReactors field, and helpers to induce particular failures.

For example:

WithReactors: []ReactorFunc{
    InduceFailure("create", "revisions"),
},

I may try to play with this today.

/assign @mattmoor

@grantr
Copy link
Contributor

grantr commented Jul 6, 2018

I like this idea, though I'm curious how it works when using listers instead of clients.

@mattmoor
Copy link
Member Author

mattmoor commented Jul 6, 2018

@grantr It won't let use cover Get or List failures, but mutations all still go through the clients.

google-prow-robot pushed a commit that referenced this issue Jul 6, 2018
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: #1501
google-prow-robot pushed a commit that referenced this issue Jul 6, 2018
This builds on #1501 to add coverage to the failure paths in the Service controller.
google-prow-robot pushed a commit that referenced this issue Jul 6, 2018
This builds on #1501 to add coverage to the failure paths in the Configuration controller.
google-prow-robot pushed a commit that referenced this issue Jul 6, 2018
This builds on #1501 to add coverage to the failure paths in the Revision controller.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API API objects and controllers area/test-and-release It flags unit/e2e/conformance/perf test issues for product features
Projects
None yet
Development

No branches or pull requests

4 participants