summaryrefslogtreecommitdiffhomepage
path: root/runsc/test/testutil/testutil.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-06-20 14:37:56 -0700
committerShentubot <shentubot@google.com>2018-06-20 14:38:45 -0700
commit2b5bdb525e99fc1ef099b2ef083a09772241ea58 (patch)
tree5edbd587b8df55e933ed27416ef8bef0ab6fa30a /runsc/test/testutil/testutil.go
parent4ad7315b6759afa81f492ec119080deb9a224101 (diff)
Add end-to-end image tests
PiperOrigin-RevId: 201418619 Change-Id: I7961b027394d98422642f829bc54745838c138bd
Diffstat (limited to 'runsc/test/testutil/testutil.go')
-rw-r--r--runsc/test/testutil/testutil.go19
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
+}