Increase Unit Test Coverage#54
Conversation
…to pub/add-unit-tests
…to pub/add-unit-tests
…to pub/add-unit-tests
…to pub/add-unit-tests
…to pub/add-unit-tests
…to pub/add-unit-tests
| // if CTX has this key, we want to return error for UT | ||
| if ctx.Value(ContextKey("returnError")) == "true" { | ||
| return nil, status.Error(codes.InvalidArgument, "Returned error from mock CreateVolume") | ||
| } |
There was a problem hiding this comment.
Is it really needed? You can induce an error by passing a bad req, e.g. req.Name longer than 128 characters.
There was a problem hiding this comment.
This is in the mock, not the driver code; I don't see a problem with having a ctx variable for returning an error, though there are potentially more elegant ways to go about it. I will see if I can find a way to inject this error otherwise and ask @JacobGros since he designed the test.
There was a problem hiding this comment.
I decided on a uniform approach for forcing errors in the mocks. Some CSI requests (like ControllerGetCapabilities) do not have any parameters, others would require a different parameter configuration to get the error to return. By setting it in the context, we have an approach that works for all mock CSI calls
Description
This PR includes substantial unit test coverage increase across gocsi packages.
GitHub Issues
List the GitHub issues impacted by this PR:
Checklist:
How Has This Been Tested?
The only packages not at 80% or above are:
All other packages are at 80% coverage or above.