Skip to content

Commit 408aa13

Browse files
committed
Corrected zstd tests
1 parent a593477 commit 408aa13

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

tests/post-command-zstd.bats

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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

77
setup() {
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

3737
teardown() {
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
}

tests/pre-command-zstd.bats

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# To debug stubs, uncomment these lines:
44
# export CACHE_DUMMY_STUB_DEBUG=/dev/tty
55
# export TAR_STUB_DEBUG=/dev/tty
6-
# export ZSTD_STUB_DEBUG=/dev/tty
76

87
setup() {
98
load "${BATS_PLUGIN_PATH}/load.bash"
@@ -23,18 +22,14 @@ setup() {
2322
export BUILDKITE_ORGANIZATION_SLUG="bk-cache-test"
2423
export BUILDKITE_PIPELINE_SLUG="cache-pipeline"
2524

26-
# stub is the same for all tests
27-
stub zstd \
28-
"-d \* \* : echo uncompressed \$2 into \$3"
29-
30-
stub tar "echo called tar with options \$@ and input; cat"
31-
25+
stub tar \
26+
"--help : echo '--zstd'" \
27+
"echo called tar with options \$@"
3228
}
3329

3430
teardown() {
3531
rm -rf tests/data
3632

37-
unstub zstd
3833
unstub tar
3934
}
4035

0 commit comments

Comments
 (0)