summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-07-31 14:23:28 +0200
committerValentin Rothberg <rothberg@redhat.com>2019-07-31 15:41:34 +0200
commitda609fc40bc42cfafb927899826a4601f0660fce (patch)
tree59b90ff571df1c66432cbba556b3d6e7187d5b0d /test/e2e
parent680a3838748b297b7c3c462f98b58f82e39218e8 (diff)
downloadpodman-da609fc40bc42cfafb927899826a4601f0660fce.tar.gz
podman-da609fc40bc42cfafb927899826a4601f0660fce.tar.bz2
podman-da609fc40bc42cfafb927899826a4601f0660fce.zip
e2e test: check exit codes for pull, save, inspect
Check the exit codes of pull, save and inspect to avoid masking those errors. We've hit a case where a corrupted/broken image has been pulled which then surfaced for some tests later. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/common_test.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 22eb94972..b43938616 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -111,10 +111,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
}
for _, image := range CACHE_IMAGES {
- if err := podman.CreateArtifact(image); err != nil {
- fmt.Printf("%q\n", err)
- os.Exit(1)
- }
+ podman.createArtifact(image)
}
// If running localized tests, the cache dir is created and populated. if the
@@ -287,25 +284,26 @@ func (p *PodmanTestIntegration) RestoreAllArtifacts() error {
return nil
}
-// CreateArtifact creates a cached image in the artifact dir
-func (p *PodmanTestIntegration) CreateArtifact(image string) error {
+// createArtifact creates a cached image in the artifact dir
+func (p *PodmanTestIntegration) createArtifact(image string) {
if os.Getenv("NO_TEST_CACHE") != "" {
- return nil
+ return
}
- fmt.Printf("Caching %s...", image)
dest := strings.Split(image, "/")
destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
+ fmt.Printf("Caching %s at %s...", image, destName)
if _, err := os.Stat(destName); os.IsNotExist(err) {
pull := p.PodmanNoCache([]string{"pull", image})
pull.Wait(90)
+ Expect(pull.ExitCode()).To(Equal(0))
save := p.PodmanNoCache([]string{"save", "-o", destName, image})
save.Wait(90)
+ Expect(save.ExitCode()).To(Equal(0))
fmt.Printf("\n")
} else {
fmt.Printf(" already exists.\n")
}
- return nil
}
// InspectImageJSON takes the session output of an inspect
@@ -322,6 +320,7 @@ func (p *PodmanTestIntegration) InspectContainer(name string) []libpod.InspectCo
cmd := []string{"inspect", name}
session := p.Podman(cmd)
session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
return session.InspectContainerToJSON()
}