22
33# To debug stubs, uncomment these lines:
44# export CACHE_DUMMY_STUB_DEBUG=/dev/tty
5- # export ZSTD_STUB_DEBUG =/dev/tty
5+ # export TAR_STUB_DEBUG =/dev/tty
66
77setup () {
88 load " ${BATS_PLUGIN_PATH} /load.bash"
@@ -26,19 +26,19 @@ setup() {
2626 export BUILDKITE_ORGANIZATION_SLUG=" bk-cache-test"
2727 export BUILDKITE_PIPELINE_SLUG=" cache-pipeline"
2828
29- # stubs are the same for every test
30- stub zstd \
31- " \* \* : echo compressed stdin into \$ 2 with options \$ 1"
32-
3329 stub cache_dummy \
3430 " save \* \* : echo saving \$ 3 in \$ 2"
31+
32+ stub tar \
33+ " --help : echo '--zstd'" \
34+ " echo called tar with options \$ @"
3535}
3636
3737teardown () {
3838 rm -rf tests/data
3939
4040 unstub cache_dummy
41- unstub zstd
41+ unstub tar
4242}
4343
4444@test " File-level saving with compression" {
@@ -50,7 +50,7 @@ teardown() {
5050 assert_success
5151 assert_output --partial ' Saving file-level cache'
5252 assert_output --partial ' Compressing tests/data/my_files with zstd'
53- assert_output --partial " with options -o "
53+ assert_output --partial " with options -c --zstd "
5454}
5555
5656@test " Step-level saving" {
@@ -119,7 +119,7 @@ teardown() {
119119 assert_success
120120 assert_output --partial ' Saving pipeline-level cache'
121121 assert_output --partial " Compressing ${BUILDKITE_PLUGIN_CACHE_PATH} with zstd..."
122- assert_output --partial " with options -o "
122+ assert_output --partial " with options -c --zstd -P "
123123
124124 rm -rf " ${BUILDKITE_PLUGIN_CACHE_PATH} "
125125}
0 commit comments