Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hallyn 2024 03 18 test rmdir #604

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,6 @@ require (
)

replace (
github.com/opencontainers/umoci => github.com/project-stacker/umoci v0.0.0-20240223003603-555a0af426e1
github.com/opencontainers/umoci => github.com/project-stacker/umoci v0.0.0-20240329154438-26d688b0d7c1
stackerbuild.io/stacker-bom => github.com/project-stacker/stacker-bom v0.0.6-0.20240227180605-9a3eb8f7f720
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,8 @@ github.com/proglottis/gpgme v0.1.3 h1:Crxx0oz4LKB3QXc5Ea0J19K/3ICfy3ftr5exgUK1AU
github.com/proglottis/gpgme v0.1.3/go.mod h1:fPbW/EZ0LvwQtH8Hy7eixhp1eF3G39dtx7GUN+0Gmy0=
github.com/project-stacker/stacker-bom v0.0.6-0.20240227180605-9a3eb8f7f720 h1:7XxHKp0cb8NfDVzZeP+Dgkx4/hdP6bXagwIRcZJNQiw=
github.com/project-stacker/stacker-bom v0.0.6-0.20240227180605-9a3eb8f7f720/go.mod h1:Z6NhOFXmg2+eBNU77lGAZkiJWyATXix3ZdEJ53Gbkws=
github.com/project-stacker/umoci v0.0.0-20240223003603-555a0af426e1 h1:TtJDnPCi3mZU56pILbuQbXwmC3EEUJgOSop8NVkAKUE=
github.com/project-stacker/umoci v0.0.0-20240223003603-555a0af426e1/go.mod h1:XUXUpCpA/Y8aJWezK1i8o4WDR0Y/vhMcWg+FUNQkKMQ=
github.com/project-stacker/umoci v0.0.0-20240329154438-26d688b0d7c1 h1:7mz6NRnsINUr9yoYLxulCbkz3yFZZu0qZa7Sx8uV1nE=
github.com/project-stacker/umoci v0.0.0-20240329154438-26d688b0d7c1/go.mod h1:XUXUpCpA/Y8aJWezK1i8o4WDR0Y/vhMcWg+FUNQkKMQ=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
Expand Down
74 changes: 74 additions & 0 deletions test/basic.bats
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,77 @@ busybox:
EOF
stacker build --substitute "a=b,c" --substitute BUSYBOX_OCI=${BUSYBOX_OCI}
}

@test "Test whiteouts across layers" {
# /aaa is created in l1, removed in l2, re-created in l3
# /bbb is created in l2, removed in l3
# /ccc is created in l2, removed and recreated in l3
# /ddd is created in l1, removed and recreated in l2, and extended in l3
cat > stacker.yaml <<"EOF"
l1:
from:
type: tar
url: .stacker/layer-bases/busybox.tar
run: |
mkdir -p /aaa/111/ab
mkdir -p /ddd/111/ab
l2:
from:
type: built
tag: l1
run: |
rm -rf /aaa
mkdir -p /bbb/111/ab
mkdir -p /ccc/111/ab
rm -rf /ddd
mkdir -p /ddd/222/ab
l3:
from:
type: built
tag: l2
run: |
rm -rf /bbb
rm -rf /ccc
mkdir -p /aaa/222/ab
mkdir -p /ccc/222/ab
mkdir -p /ddd/333/ab
l4:
from:
type: built
tag: l3
run: |
[ ! -d /aaa/111 ]
[ -d /aaa/222/ab ]
[ -d /ccc/222 ]
[ ! -d /ccc/111 ]
EOF
mkdir -p .stacker/layer-bases
chmod 777 .stacker/layer-bases
image_copy oci:$BUSYBOX_OCI oci:.stacker/layer-bases/oci:busybox
umoci unpack --image .stacker/layer-bases/oci:busybox dest
tar caf .stacker/layer-bases/busybox.tar -C dest/rootfs .
rm -rf dest
# did we really download the image to the right place?
[ -f .stacker/layer-bases/busybox.tar ]

stacker build
umoci unpack --image oci:l3 l3

# aaa/111 should be deleted, aaa/222 should exist
[ ! -d l3/rootfs/aaa/111 ]
[ -d l3/rootfs/aaa/222/ab ]

# bbb should be deleted entirely
[ ! -d l3/rootfs/bbb ]

# ccc should be like aaa - but doesn't have an intermediate layer
[ -d l3/rootfs/ccc/222 ]
[ ! -d l3/rootfs/ccc/111 ]

# ddd should have both 222 and 333 but not 111
# This is to test specifically that the opaque xattr is not copied
# up, causing 222 to be missed.
[ -d l3/rootfs/ddd/333 ]
[ -d l3/rootfs/ddd/222 ]
[ ! -d l3/rootfs/ddd/111 ]
}
Loading