docker/libcontainer — pull request #186 by Zteve (2014-09-05 00:12:06+00:00)
Title: Devices error injection

https://github.com/docker/libcontainer/issues/178 requests testing of error paths when external dependencies return errors. This pull request starts to implement this in devices.go.

The system interfaces used by devices.go are os, io/ioutil, and syscall. The syscall usages do not return errors. The usage of os is just one function call (os.Lstat) and the usage of io/ioutil is one function call (ioutil.ReadDir) from two call sites.

There are two commits, the first dealing with os.Lstat and the second dealing with ioutil.ReadDir.

These are very simple tests covering trivial cases, but should establish a pattern that can be used elsewhere.