mirror of https://github.com/containers/podman.git
test: disable artifacts cache with composefs
layers restored from a tarball won't be converted to composefs so disable the cache when using composefs. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
8403f4c33f
commit
fef125c7b1
|
@ -400,6 +400,30 @@ func imageTarPath(image string) string {
|
||||||
return filepath.Join(cacheDir, imageCacheName)
|
return filepath.Join(cacheDir, imageCacheName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *PodmanTestIntegration) pullImage(image string, toCache bool) {
|
||||||
|
if toCache {
|
||||||
|
oldRoot := p.Root
|
||||||
|
p.Root = p.ImageCacheDir
|
||||||
|
defer func() {
|
||||||
|
p.Root = oldRoot
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
for try := 0; try < 3; try++ {
|
||||||
|
podmanSession := p.PodmanBase([]string{"pull", image}, toCache, true)
|
||||||
|
pull := PodmanSessionIntegration{podmanSession}
|
||||||
|
pull.Wait(440)
|
||||||
|
if pull.ExitCode() == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if try == 2 {
|
||||||
|
Expect(pull).Should(Exit(0), "Failed after many retries")
|
||||||
|
}
|
||||||
|
|
||||||
|
GinkgoWriter.Println("Will wait and retry")
|
||||||
|
time.Sleep(time.Duration(try+1) * 5 * time.Second)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// createArtifact creates a cached image tarball in a local directory
|
// createArtifact creates a cached image tarball in a local directory
|
||||||
func (p *PodmanTestIntegration) createArtifact(image string) {
|
func (p *PodmanTestIntegration) createArtifact(image string) {
|
||||||
if os.Getenv("NO_TEST_CACHE") != "" {
|
if os.Getenv("NO_TEST_CACHE") != "" {
|
||||||
|
@ -408,19 +432,8 @@ func (p *PodmanTestIntegration) createArtifact(image string) {
|
||||||
destName := imageTarPath(image)
|
destName := imageTarPath(image)
|
||||||
if _, err := os.Stat(destName); os.IsNotExist(err) {
|
if _, err := os.Stat(destName); os.IsNotExist(err) {
|
||||||
GinkgoWriter.Printf("Caching %s at %s...\n", image, destName)
|
GinkgoWriter.Printf("Caching %s at %s...\n", image, destName)
|
||||||
for try := 0; try < 3; try++ {
|
|
||||||
pull := p.PodmanNoCache([]string{"pull", image})
|
|
||||||
pull.Wait(440)
|
|
||||||
if pull.ExitCode() == 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if try == 2 {
|
|
||||||
Expect(pull).Should(Exit(0), "Failed after many retries")
|
|
||||||
}
|
|
||||||
|
|
||||||
GinkgoWriter.Println("Will wait and retry")
|
p.pullImage(image, false)
|
||||||
time.Sleep(time.Duration(try+1) * 5 * time.Second)
|
|
||||||
}
|
|
||||||
|
|
||||||
save := p.PodmanNoCache([]string{"save", "-o", destName, image})
|
save := p.PodmanNoCache([]string{"save", "-o", destName, image})
|
||||||
save.Wait(90)
|
save.Wait(90)
|
||||||
|
@ -1036,8 +1049,14 @@ func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error {
|
||||||
|
|
||||||
func populateCache(podman *PodmanTestIntegration) {
|
func populateCache(podman *PodmanTestIntegration) {
|
||||||
for _, image := range CACHE_IMAGES {
|
for _, image := range CACHE_IMAGES {
|
||||||
err := podman.RestoreArtifactToCache(image)
|
// FIXME: Remove this hack once composefs can be used with images
|
||||||
Expect(err).ToNot(HaveOccurred())
|
// pulled from sources other than a registry.
|
||||||
|
if strings.Contains(podman.StorageOptions, "overlay.use_composefs=true") {
|
||||||
|
podman.pullImage(image, true)
|
||||||
|
} else {
|
||||||
|
err := podman.RestoreArtifactToCache(image)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// logformatter uses this to recognize the first test
|
// logformatter uses this to recognize the first test
|
||||||
GinkgoWriter.Printf("-----------------------------\n")
|
GinkgoWriter.Printf("-----------------------------\n")
|
||||||
|
|
Loading…
Reference in New Issue