diff options
Diffstat (limited to 'runsc/test/testutil')
-rw-r--r-- | runsc/test/testutil/testutil.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/runsc/test/testutil/testutil.go b/runsc/test/testutil/testutil.go index 9be4407e0..25535ea37 100644 --- a/runsc/test/testutil/testutil.go +++ b/runsc/test/testutil/testutil.go @@ -18,6 +18,7 @@ package testutil import ( "encoding/json" "fmt" + "io" "io/ioutil" "os" "path/filepath" @@ -146,3 +147,21 @@ func writeSpec(dir string, spec *specs.Spec) error { func UniqueContainerID() string { return fmt.Sprintf("test-container-%d", time.Now().UnixNano()) } + +// Copy copies file from src to dst. +func Copy(src, dst string) error { + in, err := os.Open(src) + if err != nil { + return err + } + defer in.Close() + + out, err := os.Create(dst) + if err != nil { + return err + } + defer out.Close() + + _, err = io.Copy(out, in) + return err +} |