From 6a01b3aca489fcb1adbe49b235f7a966602ec8c5 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:57:29 +0100 Subject: [PATCH] debug --- bin/compile | 3 +++ test/run | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/bin/compile b/bin/compile index ac34854..76759c4 100755 --- a/bin/compile +++ b/bin/compile @@ -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}" diff --git a/test/run b/test/run index 2671ad7..d0daea0 100755 --- a/test/run +++ b/test/run @@ -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 }