summaryrefslogtreecommitdiff
path: root/test/e2e/libpod_suite_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-rw-r--r--test/e2e/libpod_suite_test.go22
1 files changed, 16 insertions, 6 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index fa48334a3..1383b5a19 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"
@@ -109,7 +111,6 @@ var _ = BeforeSuite(func() {
}
}
for _, image := range CACHE_IMAGES {
- fmt.Printf("Caching %s...\n", image)
if err := podman.CreateArtifact(image); err != nil {
fmt.Printf("%q\n", err)
os.Exit(1)
@@ -298,6 +299,10 @@ func (p *PodmanTest) SystemExec(command string, args []string) *PodmanSession {
// CreateArtifact creates a cached image in the artifact dir
func (p *PodmanTest) CreateArtifact(image string) error {
+ if os.Getenv("NO_TEST_CACHE") != "" {
+ return nil
+ }
+ fmt.Printf("Caching %s...\n", image)
imageName := fmt.Sprintf("docker://%s", image)
systemContext := types.SystemContext{
SignaturePolicyPath: p.SignaturePolicyPath,
@@ -327,9 +332,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 +381,7 @@ func (p *PodmanTest) RestoreArtifact(image string) error {
}()
options := &copy.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)
}
@@ -387,6 +390,9 @@ func (p *PodmanTest) RestoreArtifact(image string) error {
// RestoreAllArtifacts unpacks all cached images
func (p *PodmanTest) RestoreAllArtifacts() error {
+ if os.Getenv("NO_TEST_CACHE") != "" {
+ return nil
+ }
for _, image := range RESTORE_IMAGES {
if err := p.RestoreArtifact(image); err != nil {
return err
@@ -487,7 +493,7 @@ func (s *PodmanSession) LineInOuputStartsWith(term string) bool {
//LineInOutputContains returns true if a line in a
// session output starts with the supplied string
-func (s *PodmanSession) LineInOuputContains(term string) bool {
+func (s *PodmanSession) LineInOutputContains(term string) bool {
for _, i := range s.OutputToStringArray() {
if strings.Contains(i, term) {
return true
@@ -622,3 +628,7 @@ func IsCommandAvailable(command string) bool {
}
return true
}
+
+func getTestContext() context.Context {
+ return context.Background()
+}