From d0ccbee47da0e6b40a2a2e23244c31e5827aba91 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Wed, 23 Oct 2024 14:00:45 -0400 Subject: [PATCH] Try to fix restorer acceptance Signed-off-by: Natalie Arellano --- acceptance/restorer_test.go | 3 ++- acceptance/testdata/restorer/Dockerfile | 7 ------- .../io.buildpacks.lifecycle.cache.metadata | 2 +- ...7b9c99ad05776a89d19ab863c28850a91e5f2944.tar | Bin 0 -> 10240 bytes ...843599d96afe28784cffcb2d46ddb07beb00df78.tar | Bin 0 -> 10240 bytes cache/volume_cache.go | 3 +-- 6 files changed, 4 insertions(+), 11 deletions(-) create mode 100644 acceptance/testdata/restorer/container/cache/committed/sha256:2d9c9c638d5c4f0df067eeae7b9c99ad05776a89d19ab863c28850a91e5f2944.tar create mode 100644 acceptance/testdata/restorer/container/cache/committed/sha256:430338f576c11e5236669f9c843599d96afe28784cffcb2d46ddb07beb00df78.tar diff --git a/acceptance/restorer_test.go b/acceptance/restorer_test.go index 2e6b14561..3017966f9 100644 --- a/acceptance/restorer_test.go +++ b/acceptance/restorer_test.go @@ -131,7 +131,7 @@ func testRestorerFunc(platformAPI string) func(t *testing.T, when spec.G, it spe when("using cache-dir", func() { when("there is cache present from a previous build", func() { it("restores cached layer data", func() { - h.DockerRunAndCopy(t, + output := h.DockerRunAndCopy(t, containerName, copyDir, "/layers", @@ -139,6 +139,7 @@ func testRestorerFunc(platformAPI string) func(t *testing.T, when spec.G, it spe h.WithFlags("--env", "CNB_PLATFORM_API="+platformAPI), h.WithArgs("-cache-dir", "/cache"), ) + t.Log("XXX", output) // check restored cache file is present cachedFile := filepath.Join(copyDir, "layers", "cacher_buildpack", "cached-layer", "data") diff --git a/acceptance/testdata/restorer/Dockerfile b/acceptance/testdata/restorer/Dockerfile index 975cdb3ed..06a749401 100644 --- a/acceptance/testdata/restorer/Dockerfile +++ b/acceptance/testdata/restorer/Dockerfile @@ -8,13 +8,6 @@ ENV CNB_GROUP_ID=${cnb_gid} COPY ./container/ / -# turn /to_cache/ directories into cache tarballs -# these are referenced by sha in /cache/committed/io.buildpacks.lifecycle.cache.metadata -RUN tar cvf /cache/committed/sha256:2d9c9c638d5c4f0df067eeae7b9c99ad05776a89d19ab863c28850a91e5f2944.tar -C /to_cache/cacher_buildpack layers -RUN tar cvf /cache/committed/sha256:58bafa1e79c8e44151141c95086beb37ca85b69578fc890bce33bb4c6c8e851f.tar -C /to_cache/unused_buildpack layers -# this layer has sha not matching the actual contents -RUN tar cvf /cache/committed/sha256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c.tar -C /to_cache/corrupted_buildpack layers - ENTRYPOINT ["/cnb/lifecycle/restorer"] RUN groupadd cnb --gid ${cnb_gid} && \ diff --git a/acceptance/testdata/restorer/container/cache/committed/io.buildpacks.lifecycle.cache.metadata b/acceptance/testdata/restorer/container/cache/committed/io.buildpacks.lifecycle.cache.metadata index b94d82c76..51c7edd77 100644 --- a/acceptance/testdata/restorer/container/cache/committed/io.buildpacks.lifecycle.cache.metadata +++ b/acceptance/testdata/restorer/container/cache/committed/io.buildpacks.lifecycle.cache.metadata @@ -31,7 +31,7 @@ "version": "v1", "layers": { "cached-layer": { - "sha": "sha256:58bafa1e79c8e44151141c95086beb37ca85b69578fc890bce33bb4c6c8e851f", + "sha": "sha256:430338f576c11e5236669f9c843599d96afe28784cffcb2d46ddb07beb00df78", "data": null, "build": false, "launch": false, diff --git a/acceptance/testdata/restorer/container/cache/committed/sha256:2d9c9c638d5c4f0df067eeae7b9c99ad05776a89d19ab863c28850a91e5f2944.tar b/acceptance/testdata/restorer/container/cache/committed/sha256:2d9c9c638d5c4f0df067eeae7b9c99ad05776a89d19ab863c28850a91e5f2944.tar new file mode 100644 index 0000000000000000000000000000000000000000..2dae6cc55dbd0bba0440c01d9e25848a1fac3ac0 GIT binary patch literal 10240 zcmeIy-3o#*9Eaf@cNN}1G;<%96HA36!SLgtyKh=SiJ@SI(Yuq$=5##2{g=5*T9g|x zXOq5Jtwq!O*6rJ|P#GJB(ni_}=^u;{fu3_yk8jsy<%%E>MV?oWvA%w2zHiMBjAgg{ zV;3LNVz;l4S#oyq>7xgt33xbvE49+r8s+m>kqXKG8^`Be{_TNC*6sAv!!R!Y=lVBB zZ^?f#`6sS&6E@T2Z)DEIri8yo5$%@3{lfwAI} zf3s_<+%H$nrtk-sZC`pI+JK+SUnyzH{}adOUjCWO*13<*(^C(_^Z6T_O7j1j{JpE) zgw3@18>RYnzq^-mk&4^;AF4(8|K)^lj$Zob_5V`%