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,16 +400,17 @@ func imageTarPath(image string) string {
|
|||
return filepath.Join(cacheDir, imageCacheName)
|
||||
}
|
||||
|
||||
// createArtifact creates a cached image tarball in a local directory
|
||||
func (p *PodmanTestIntegration) createArtifact(image string) {
|
||||
if os.Getenv("NO_TEST_CACHE") != "" {
|
||||
return
|
||||
func (p *PodmanTestIntegration) pullImage(image string, toCache bool) {
|
||||
if toCache {
|
||||
oldRoot := p.Root
|
||||
p.Root = p.ImageCacheDir
|
||||
defer func() {
|
||||
p.Root = oldRoot
|
||||
}()
|
||||
}
|
||||
destName := imageTarPath(image)
|
||||
if _, err := os.Stat(destName); os.IsNotExist(err) {
|
||||
GinkgoWriter.Printf("Caching %s at %s...\n", image, destName)
|
||||
for try := 0; try < 3; try++ {
|
||||
pull := p.PodmanNoCache([]string{"pull", image})
|
||||
podmanSession := p.PodmanBase([]string{"pull", image}, toCache, true)
|
||||
pull := PodmanSessionIntegration{podmanSession}
|
||||
pull.Wait(440)
|
||||
if pull.ExitCode() == 0 {
|
||||
break
|
||||
|
@ -421,6 +422,18 @@ func (p *PodmanTestIntegration) createArtifact(image string) {
|
|||
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
|
||||
func (p *PodmanTestIntegration) createArtifact(image string) {
|
||||
if os.Getenv("NO_TEST_CACHE") != "" {
|
||||
return
|
||||
}
|
||||
destName := imageTarPath(image)
|
||||
if _, err := os.Stat(destName); os.IsNotExist(err) {
|
||||
GinkgoWriter.Printf("Caching %s at %s...\n", image, destName)
|
||||
|
||||
p.pullImage(image, false)
|
||||
|
||||
save := p.PodmanNoCache([]string{"save", "-o", destName, image})
|
||||
save.Wait(90)
|
||||
|
@ -1036,9 +1049,15 @@ func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error {
|
|||
|
||||
func populateCache(podman *PodmanTestIntegration) {
|
||||
for _, image := range CACHE_IMAGES {
|
||||
// FIXME: Remove this hack once composefs can be used with images
|
||||
// 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
|
||||
GinkgoWriter.Printf("-----------------------------\n")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue