use mockery to create Docker API mocks, a part of #587#588
Conversation
28375a8 to
6569561
Compare
| @@ -0,0 +1,10 @@ | |||
| package dockermock | |||
There was a problem hiding this comment.
Remove this file, you can generate mock directly from vendor
mockery -name CommonAPIClient -dir vendor/github.com/docker/docker/client -inpkg
There was a problem hiding this comment.
I didn't want to access to vendor folder directly. It's a bit messy and we can easily avoid it like with the current implementation.
| mockery -name=Container -dir ./container -output ./container/mocks | ||
|
|
||
| # generate mocks for docker.CommonAPIClient that used by container package. | ||
| mockery -name=Docker -dir ./utils/docker -inpkg |
There was a problem hiding this comment.
out file - mock_Docker.go -> don't use capital letters in filename.
There was a problem hiding this comment.
I couldn't see a configuration related to this in mockery's cli. You can open an issue on their repo page. But I think it's OK this way.
There was a problem hiding this comment.
I also thinking about adding -testonly flag to all mocks, but we can start with this one.
There was a problem hiding this comment.
I tried it and applied it to all other mocks but as I see, it messes with the interface names as well. For example, ServiceDB.go mock file for ServiceDB interface becomes to service_db.go and I don't like this naming. I prefer to skip setting the case, it's not that important anyway.
|
@krhubert can you review this pr please |
No description provided.