Export crud.MockStore and allow mocking errors
The MockStore struct is very useful for tests outside of the crud package, since it has an in-memory implementation of the crud.Store interface. This adds the ability to mock errors to test out how code that wrap the store handle edge cases and then exports the struct.
Improve matching of not found errors
Previously in the claim and credential store, we matched exactly on the underlying not found errors from the crud store. This doesn't work well when the store may be being wrapped in layers, for example in Porter's case the store error is wrapped in an net/rpc error so the error doesn't match exactly.
This changes the matching to allow for how errors are usually wrapped, with an error message appended and the original message preserved within the error message.
We care because it allows the claim store and credential store to detect "not found" scenarios and present a more clear error message such as "Claim not found" instead of "file not found" when in many cases the claim may not be represented as a file anyway.
Improve matching of not found errors Previously in the claim and credential store, we matched exactly on the underlying not found errors from the crud store. This doesn't work well when the store may be being wrapped in layers, for example in Porter's case the store error is wrapped in an net/rpc error so the error doesn't match exactly.
This changes the matching to allow for how errors are usually wrapped, with an error message appended and the original message preserved within the error message.
We care because it allows the claim store and credential store to detect "not found" scenarios and present a more clear error message such as "Claim not found" instead of "file not found" when in many cases the claim may not be represented as a file anyway.