Docker Community Forums

Share and learn in the Docker community.

Practices for testing plugin development ("distributed" volume plugin)


(Davelindquist) #1

For fun and profit (ok, skip the profit part), I’m developing a volume plugin for docker – specifically one to deal with volumes for swarm services.

However, I don’t really see a lot of discussion/best practices on how to best test plugins, and especially not when those plugins are in a distributed swarm environment (and the plugin needs to communicate between the swarm hosts).

I can, of course, create go unit tests for all of the pieces in my plugin, but what do folks do at the ‘integration’ level?

I could probably:

  • “Mock” out all of the docker communication, intra-server communication, and volume-mounting (ugh, that’d be a fair bit of work)

– OR –

  • Set up virtual docker servers (say, fully scripted qemu/kvm), install the plugin on each, and test it that way (a bit heavy, and definitely not as clean as a go test file – not to mention hard to do in any CI)

But I have to think that this is a problem others have encountered… How do others solve this? Is there some ‘best practices’ discussion elsewhere that I’ve missed?

(And on the same note, I can’t seem to find any docker forum for plugin development…?)

Thanks in advance!
Dave


(Archimedes Trajano) #2

https://github.com/sapk/docker-volume-gluster has some integration tests. Though I ended up making my own docker volume plugins instead.

I didn’t do integration tests as he did (since I couldn’t figure out really how to get them working anyway) my integration tests are therefore manual and painful. But it also involved trying to figure out how things worked.