Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

increase unit test coverage on create.go #401

Closed
jodh-intel opened this issue Aug 10, 2017 · 0 comments
Closed

increase unit test coverage on create.go #401

jodh-intel opened this issue Aug 10, 2017 · 0 comments
Assignees

Comments

@jodh-intel
Copy link
Contributor

Currently very low coverage.

See #93.

@jodh-intel jodh-intel self-assigned this Aug 11, 2017
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 14, 2017
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>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 14, 2017
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>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 14, 2017
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>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 14, 2017
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>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 14, 2017
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>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 14, 2017
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>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 23, 2017
Added 18 new tests. Coverage (when run as root) is 87.1% (actually,
it's higher since some tests require non-root to run).

Fixes clearcontainers#401.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 23, 2017
Added 18 new tests. Coverage (when run as root) is 87.1% (actually,
it's higher since some tests require non-root to run).

Fixes clearcontainers#401.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 23, 2017
Added 18 new tests. Coverage (when run as root) is 90.3%
(actually, it's higher since some tests require non-root to run).

Fixes clearcontainers#401.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 23, 2017
Added 19 new tests. Coverage (when run as root) is 90.3%
(actually, it's higher since some tests require non-root to run).

Fixes clearcontainers#401.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 24, 2017
Added 19 new tests. Coverage (when run as root) is 90.3% (actually,
94.6% when combining root and non-root test runs (some tests require
non-root to run)).

Fixes clearcontainers#401.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
jodh-intel added a commit to jodh-intel/runtime that referenced this issue Aug 24, 2017
Added 19 new tests. Coverage (when run as root) is 90.3% (actually,
94.6% when combining root and non-root test runs (some tests require
non-root to run)).

Fixes clearcontainers#401.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
mcastelino pushed a commit to mcastelino/runtime that referenced this issue Dec 6, 2018
1. Fix config installation not exec permission is needed.

2. Makefile install all in DESTDIR.

make install DESTDIR=/tmp/dest/

Before:
$tree /tmp/dest/
/tmp/dest/
└── usr
    ├── bin
    │   └── kata-collect-data.sh
    └── share
        └── defaults
            └── kata-containers
                └── configuration.toml

5 directories, 2 files

Now:
$tree /tmp/dest/
/tmp/dest/
└── usr
    ├── local
    │   └── bin
    │       ├── kata-collect-data.sh
    │       └── kata-runtime
    └── share
        ├── bash-completion
        │   └── completions
        │       └── kata-runtime
        └── defaults
            └── kata-containers
                └── configuration.toml

Fixes: clearcontainers#401

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

2 participants