Skip to content

Commit

Permalink
Re-Add file check to cacheing algorithm
Browse files Browse the repository at this point in the history
Regardless, I've added a test as part of this PR to catch this issue
going forward.

Fixes:  containers#1906

Signed-off-by: TomSweeneyRedHat <[email protected]>
  • Loading branch information
TomSweeneyRedHat authored and nalind committed Oct 30, 2019
1 parent 3a90cf5 commit bb90f81
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/bud.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1818,3 +1818,29 @@ load helpers
run_buildah bud --signature-policy ${TESTSDIR}/policy.json --layers -t ${target} git://github.com/containers/BuildSourceImage#master
run_buildah bud --signature-policy ${TESTSDIR}/policy.json --layers -t ${target} git://github.com/containers/BuildSourceImage
}

@test "bud containerfile with tar archive in copy" {
# First check to verify cache is uses if the tar file does not change
target=copy-archive
date>bud/${target}/test; tar cJf - bud/${target}/test > bud/${target}/test.tar.xz
run_buildah bud --signature-policy ${TESTSDIR}/policy.json --layers -t ${target} ${TESTSDIR}/bud/${target}
expect_output --substring "COMMIT copy-archive"

run_buildah bud --signature-policy ${TESTSDIR}/policy.json --layers -t ${target} ${TESTSDIR}/bud/${target}
expect_output --substring " Using cache"
expect_output --substring "COMMIT copy-archive"

# Now test that we do NOT use cache if the tar file changes
date>bud/${target}/test; tar cJf - bud/${target}/test > bud/${target}/test.tar.xz
run_buildah bud --signature-policy ${TESTSDIR}/policy.json --layers -t ${target} ${TESTSDIR}/bud/${target}
expect_output --substring "COMMIT copy-archive"

date>bud/${target}/test; tar cJf - bud/${target}/test > bud/${target}/test.tar.xz
run_buildah bud --signature-policy ${TESTSDIR}/policy.json --layers -t ${target} ${TESTSDIR}/bud/${target}
if [[ "$output" =~ " Using cache" ]]; then
is "$output" "[no instance of 'Using cache']" "no cache used"
fi
expect_output --substring "COMMIT copy-archive"

rm bud/${target}/test*
}
2 changes: 2 additions & 0 deletions tests/bud/copy-archive/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM docker.io/busybox
ADD test.tar.xz /

0 comments on commit bb90f81

Please sign in to comment.