diff options
author | umohnani8 <umohnani@redhat.com> | 2018-04-18 16:48:35 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-19 14:08:47 +0000 |
commit | 27107fdac1d75f97caab47cd13efb1d9900cf350 (patch) | |
tree | f5edafbb52505829b15e19ea6a9e66f4440e862b /test | |
parent | 6a9dbf3305e93e5e1c3bff09402a9b801c935fbd (diff) | |
download | podman-27107fdac1d75f97caab47cd13efb1d9900cf350.tar.gz podman-27107fdac1d75f97caab47cd13efb1d9900cf350.tar.bz2 podman-27107fdac1d75f97caab47cd13efb1d9900cf350.zip |
Vendor in latest containers/image and contaners/storage
Made necessary changes to functions to include contex.Context wherever needed
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #640
Approved by: baude
Diffstat (limited to 'test')
-rw-r--r-- | test/bin2img/bin2img.go | 12 | ||||
-rw-r--r-- | test/copyimg/copyimg.go | 8 | ||||
-rw-r--r-- | test/e2e/libpod_suite_test.go | 12 |
3 files changed, 20 insertions, 12 deletions
diff --git a/test/bin2img/bin2img.go b/test/bin2img/bin2img.go index b5be8615a..644832c77 100644 --- a/test/bin2img/bin2img.go +++ b/test/bin2img/bin2img.go @@ -3,6 +3,7 @@ package main import ( "archive/tar" "bytes" + "context" "encoding/json" "io" "os" @@ -148,13 +149,14 @@ func main() { logrus.Errorf("error parsing image name: %v", err) os.Exit(1) } - img, err := ref.NewImageDestination(nil) + ctx := context.TODO() + img, err := ref.NewImageDestination(ctx, nil) if err != nil { logrus.Errorf("error preparing to write image: %v", err) os.Exit(1) } defer img.Close() - layer, err := img.PutBlob(layerBuffer, layerInfo, false) + layer, err := img.PutBlob(ctx, layerBuffer, layerInfo, false) if err != nil { logrus.Errorf("error preparing to write image: %v", err) os.Exit(1) @@ -182,7 +184,7 @@ func main() { Digest: digest.Canonical.FromBytes(cbytes), Size: int64(len(cbytes)), } - configInfo, err = img.PutBlob(bytes.NewBuffer(cbytes), configInfo, false) + configInfo, err = img.PutBlob(ctx, bytes.NewBuffer(cbytes), configInfo, false) if err != nil { logrus.Errorf("error saving configuration: %v", err) os.Exit(1) @@ -207,12 +209,12 @@ func main() { logrus.Errorf("error encoding manifest: %v", err) os.Exit(1) } - err = img.PutManifest(mbytes) + err = img.PutManifest(ctx, mbytes) if err != nil { logrus.Errorf("error saving manifest: %v", err) os.Exit(1) } - err = img.Commit() + err = img.Commit(ctx) if err != nil { logrus.Errorf("error committing image: %v", err) os.Exit(1) diff --git a/test/copyimg/copyimg.go b/test/copyimg/copyimg.go index f83f92766..26100beea 100644 --- a/test/copyimg/copyimg.go +++ b/test/copyimg/copyimg.go @@ -1,6 +1,7 @@ package main import ( + "context" "os" "github.com/containers/image/copy" @@ -156,9 +157,10 @@ func main() { } } + ctx := context.TODO() if imageName != "" { if importFrom != "" { - err = copy.Image(policyContext, ref, importRef, options) + err = copy.Image(ctx, policyContext, ref, importRef, options) if err != nil { logrus.Errorf("error importing %s: %v", importFrom, err) os.Exit(1) @@ -178,7 +180,7 @@ func main() { } } if exportTo != "" { - err = copy.Image(policyContext, exportRef, ref, options) + err = copy.Image(ctx, policyContext, exportRef, ref, options) if err != nil { logrus.Errorf("error exporting %s: %v", exportTo, err) os.Exit(1) @@ -186,7 +188,7 @@ func main() { } } else { if importFrom != "" && exportTo != "" { - err = copy.Image(policyContext, exportRef, importRef, options) + err = copy.Image(ctx, policyContext, exportRef, importRef, options) if err != nil { logrus.Errorf("error copying %s to %s: %v", importFrom, exportTo, err) os.Exit(1) diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index 170b24667..1d770accd 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -1,6 +1,7 @@ package integration import ( + "context" "fmt" "io/ioutil" "os" @@ -12,6 +13,7 @@ import ( "time" "encoding/json" + "github.com/containers/image/copy" "github.com/containers/image/signature" "github.com/containers/image/storage" @@ -327,9 +329,7 @@ func (p *PodmanTest) CreateArtifact(image string) error { return errors.Errorf("error parsing image name %v: %v", exportTo, err) } - return copy.Image(policyContext, exportRef, importRef, options) - - return nil + return copy.Image(getTestContext(), policyContext, exportRef, importRef, options) } // RestoreArtifact puts the cached image into our test store @@ -378,7 +378,7 @@ func (p *PodmanTest) RestoreArtifact(image string) error { }() options := ©.Options{} - err = copy.Image(policyContext, ref, importRef, options) + err = copy.Image(getTestContext(), policyContext, ref, importRef, options) if err != nil { return errors.Errorf("error importing %s: %v", importFrom, err) } @@ -622,3 +622,7 @@ func IsCommandAvailable(command string) bool { } return true } + +func getTestContext() context.Context { + return context.Background() +} |