Skip to content

Commit

Permalink
test: disable artifacts cache with composefs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
giuseppe committed Jul 23, 2024
1 parent 694bc38 commit 8479b39
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 6 additions & 0 deletions contrib/cirrus/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ if [[ "$CI_DESIRED_STORAGE" = "composefs" ]]; then
if [[ "$PRIV_NAME" == "root" ]]; then
CI_DESIRED_COMPOSEFS="+composefs"

# artifacts restored from a tarball won't be stored correctly
# in composefs, so we need to disable this feature.
export CI_NO_TEST_ARTIFACTS=true

# KLUDGE ALERT! Magic options needed for testing composefs.
# This option was intended for passing one arg to --storage-opt
# but we're hijacking it to pass an extra option+arg. And it
Expand Down Expand Up @@ -213,6 +217,8 @@ mount -t tmpfs -o size=75%,mode=0700 none /var/lib/containers
# shellcheck disable=SC2154
showrun echo "Setting CI_DESIRED_STORAGE [=$CI_DESIRED_STORAGE] for *e2e* tests"
echo "STORAGE_FS=$CI_DESIRED_STORAGE" >>/etc/ci_environment
showrun echo "Setting CI_NO_TEST_ARTIFACTS [=$CI_NO_TEST_ARTIFACTS] for *e2e* tests"
echo "CI_NO_TEST_ARTIFACTS=$CI_NO_TEST_ARTIFACTS" >>/etc/ci_environment

# Required to be defined by caller: The environment where primary testing happens
# shellcheck disable=SC2154
Expand Down
15 changes: 10 additions & 5 deletions test/e2e/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ var _ = SynchronizedBeforeSuite(func() []byte {
podman := PodmanTestSetup(filepath.Join(globalTmpDir, "image-init"))

// Pull cirros but don't put it into the cache
podman.createArtifact(CIRROS_IMAGE, true)
for _, image := range CACHE_IMAGES {
podman.createArtifact(image, false)
pullImages := []string{CIRROS_IMAGE, volumeTest}
pullImages = append(pullImages, CACHE_IMAGES...)
for _, image := range pullImages {
podman.createArtifact(image)
}

if err := os.MkdirAll(filepath.Join(ImageCacheDir, podman.ImageCacheFS+"-images"), 0777); err != nil {
Expand Down Expand Up @@ -401,7 +402,11 @@ func imageTarPath(image string) string {

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)
Expand All @@ -420,8 +425,8 @@ func (p *PodmanTestIntegration) pullImage(image string, toCache bool) {
}

// createArtifact creates a cached image tarball in a local directory
func (p *PodmanTestIntegration) createArtifact(image string, force bool) {
if !force && os.Getenv("NO_TEST_CACHE") != "" {
func (p *PodmanTestIntegration) createArtifact(image string) {
if os.Getenv("NO_TEST_CACHE") != "" {
return
}
destName := imageTarPath(image)
Expand Down

0 comments on commit 8479b39

Please sign in to comment.