Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
edmorley committed Jun 21, 2024
1 parent 29c50a8 commit 6a01b3a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ else
CACHED_STACK=
fi

echo "STACK=${STACK}."
echo "CACHED_STACK=${CACHED_STACK}."

# Ensure we store the STACK in the cache for next time.
mkdir -p "${CACHE_DIR}/.apt"
echo "${STACK}" > "${STACK_VERSION_FILE}"
Expand Down
10 changes: 10 additions & 0 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,34 @@ testCacheInvalidation() {
cache_dir=$(mktmpdir)

# Cold cache
echo "## One"
compile "package-names" "${cache_dir}"
cat ${STD_OUT}
assertCaptured "Detected Aptfile or Stack changes, flushing cache"
assertCapturedSuccess

# Warm cache
echo "## Two"
compile "package-names" "${cache_dir}"
cat ${STD_OUT}
assertCaptured "Reusing cache"
assertCapturedSuccess

# Cache invalidated on stack change
echo "## Three"
compile "package-names" "${cache_dir}"
ls -alR "${cache_dir}"
cat "${cache_dir}/.apt/STACK"
echo 'some-old-stack' > "${cache_dir}/.apt/STACK"
cat ${STD_OUT}
assertCaptured "Detected Aptfile or Stack changes, flushing cache"
assertCapturedSuccess

# Cache invalidated if stack version file missing (eg cache from old buildpack version)
echo "## Four"
compile "package-names" "${cache_dir}"
rm "${cache_dir}/.apt/STACK"
cat ${STD_OUT}
assertCaptured "Detected Aptfile or Stack changes, flushing cache"
assertCapturedSuccess
}
Expand Down

0 comments on commit 6a01b3a

Please sign in to comment.