forked from clearcontainers/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add framework to mock virtcontainers
Add a simple test framework to allow the behaviour of the virtcontainers package to be mocked. This change introduces a RVC interface and provides two implementations: one for virtcontainers itself (rvc-implementation.go) and another mock implementation for the tests to allow the behaviour of the virtcontainers package to be modified (rvc-implementation_test.go). By only accessing the virtcontainers implementation via the "vci" variable, the tests can be switched to the mock implementation. Note that this mocking is used rather than testing virtcontainers directly since the virtcontainers API is already tested in that package: the mock framework thus avoids duplication of test code and allows more fine-grained error scenarios to be handled. This change also introduces a single new test, TestCreate(), that increases the unit test coverage of create.go by using the new framework to force create() to fail due to a virtcontainers failure in CreatePod(). Fixes clearcontainers#401. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
- Loading branch information
1 parent
5dea7cb
commit cd114f9
Showing
14 changed files
with
730 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.