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

tests: Add helper functions #452

Merged
merged 1 commit into from
Aug 23, 2017

Conversation

jodh-intel
Copy link
Contributor

Add various helper functions to allow the easy creation of
virtcontainers objects and the manipulation of OCI resources:

func newTestCmd() vc.Cmd
func newTestContainerConfig(dir string) vc.ContainerConfig
func newTestHypervisorConfig(dir string, create bool) (vc.HypervisorConfig, error)
func newTestPodConfigNoop(dir string, create bool) (vc.PodConfig, error)
func newTestRuntimeConfig(dir, consolePath string, create bool) (oci.RuntimeConfig, error)

func createOCIConfig(bundleDir string) error
func makeOCIBundle(bundleDir string) error
func readOCIConfigFile(configPath string) (oci.CompatOCISpec, error)
func writeOCIConfigFile(spec oci.CompatOCISpec, configPath string) error

func runCommandFull(args []string, includeStderr bool) (string, error)

Fixes #451.

Signed-off-by: James O. D. Hunt james.o.hunt@intel.com

Add various helper functions to allow the easy creation of
virtcontainers objects and the manipulation of OCI resources:

    func newTestCmd() vc.Cmd
    func newTestContainerConfig(dir string) vc.ContainerConfig
    func newTestHypervisorConfig(dir string, create bool) (vc.HypervisorConfig, error)
    func newTestPodConfigNoop(dir string, create bool) (vc.PodConfig, error)
    func newTestRuntimeConfig(dir, consolePath string, create bool) (oci.RuntimeConfig, error)

    func createOCIConfig(bundleDir string) error
    func makeOCIBundle(bundleDir string) error
    func readOCIConfigFile(configPath string) (oci.CompatOCISpec, error)
    func writeOCIConfigFile(spec oci.CompatOCISpec, configPath string) error

    func runCommandFull(args []string, includeStderr bool) (string, error)

Fixes clearcontainers#451.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
@coveralls
Copy link

coveralls commented Aug 23, 2017

Coverage Status

Coverage increased (+0.2%) to 55.839% when pulling f2e6d08 on jodh-intel:add-test-utility-funcs into 175ac6a on clearcontainers:master.

@sboeuf
Copy link
Contributor

sboeuf commented Aug 23, 2017

According to the commit message, "easy creation of virtcontainers objects and the manipulation of OCI resources", don't you think this is something that should live in virtcontainers repo ?

@jodh-intel
Copy link
Contributor Author

Well, some of these functions actually do live in vc already. But they are private to the virtcontainers tests.

So, we either make them public and move them out of the test files in virtcontainers, or implement our own minimal set as I've done on this PR.

@grahamwhaley
Copy link
Contributor

grahamwhaley commented Aug 23, 2017

OK, I've not studied in detail or tried it out, but the notion and a quick scan of the code:
lgtm

CI seems to be taking a while here....

Approved with PullApprove Approved with PullApprove

@grahamwhaley
Copy link
Contributor

and there we go. @sboeuf if you are happy, go ahead and merge etc.

@sboeuf
Copy link
Contributor

sboeuf commented Aug 23, 2017

@jodh-intel ok fair enough.
LGTM

Approved with PullApprove

@sboeuf sboeuf merged commit 4e9e1b6 into clearcontainers:master Aug 23, 2017
mcastelino pushed a commit to mcastelino/runtime that referenced this pull request Dec 6, 2018
Adding cid+sid fields to the log entries generated by most of the CLI
commands will make debugging across the system easier.

Fixes clearcontainers#452.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants