cnabio / cnab-go

A Go implementation of CNAB Core 1.0
MIT License
69 stars 37 forks source link

Testing for the Docker driver #103

Open radu-matei opened 5 years ago

radu-matei commented 5 years ago

I've been going through the Docker driver code and I realized that it currently has no testing, and we should probably add some.

@silvin-lubecki - is there a fake Docker client / CLI / standard way of testing the creation of containers, adding volumes and other typical operations we might execute with the Docker driver?

silvin-lubecki commented 5 years ago

Hello @radu-matei sorry I missed this one 😅 In the docker/cli there's a FakeClibut put on purpose in theinternal` package because we don't think it's at the right level for tests. We instead prefer faking the docker client, like here. Unfortunately the client is a giant interface 😞, but using this pattern I guess you only have to implement the methods you are using? Or maybe we should abstract from the docker client/cli and have our own interface in the cnab-go?

radu-matei commented 5 years ago

We do have the integration tests now, which directly create a container.

That being said, executing that test does require a Docker daemon, and it would be nice if we had a fake client.