diff --git a/README.md b/README.md index 43fc6e6..ebe830f 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,14 @@ You also need the agent to have access to the following defined environment vari Setting the `BUILDKITE_PLUGIN_S3_CACHE_ONLY_SHOW_ERRORS` environment variable will reduce logging of file operations towards S3. +### `compression` (string, optional) + +Allows for the cached file/folder to be saved/restored as a single file. You will need to make sure to use the same compression when saving and restoring or it will cause a cache miss. + +Assuming the underlying executables are available, the allowed values are: +* `tgz`: `tar` with gzip compression +* `zip`: `(un)zip` compression + ### `manifest` (string, required if using `file` caching level) A path to a file or folder that will be hashed to create file-level caches. diff --git a/hooks/post-checkout b/hooks/post-checkout index d8689ca..05db6ab 100755 --- a/hooks/post-checkout +++ b/hooks/post-checkout @@ -22,7 +22,23 @@ elif [ "${MAX_LEVEL}" = 'file' ] && [ -z "$(plugin_read_config MANIFEST)" ]; the exit 1 fi -build_key "${MAX_LEVEL}" "${RESTORE_PATH}" # to validate the level +COMPRESS=$(plugin_read_config COMPRESSION 'none') +if ! validate_compression "${COMPRESS}"; then + echo "+++ 🚨 Invalid value for compression option" + exit 1 +fi + +build_key "${MAX_LEVEL}" "${RESTORE_PATH}" >/dev/null # to validate the level + +ACTUAL_PATH=$(mktemp) + +if [ "${COMPRESS}" = 'tgz' ]; then + UNCOMPRESS_COMMAND=(tar xzf) +elif [ "${COMPRESS}" = 'zip' ]; then + UNCOMPRESS_COMMAND=(unzip) +else + ACTUAL_PATH="${RESTORE_PATH}" +fi SORTED_LEVELS=(file step branch pipeline all) @@ -31,10 +47,16 @@ for CURRENT_LEVEL in "${SORTED_LEVELS[@]}"; do continue fi - KEY=$(build_key "${CURRENT_LEVEL}" "${RESTORE_PATH}") + KEY=$(build_key "${CURRENT_LEVEL}" "${RESTORE_PATH}" "${COMPRESS}") if backend_exec exists "${KEY}"; then echo "Cache hit at ${CURRENT_LEVEL} level, restoring ${RESTORE_PATH}..." - backend_exec get "${KEY}" "${RESTORE_PATH}" + backend_exec get "${KEY}" "${ACTUAL_PATH}" + + if [ "${COMPRESS}" != 'none' ]; then + echo "Cache is compressed, uncompressing..." + "${UNCOMPRESS_COMMAND[@]}" "${ACTUAL_PATH}" "${RESTORE_PATH}" + fi + exit 0 elif [ "${CURRENT_LEVEL}" = "${MAX_LEVEL}" ]; then echo "Cache miss up to ${CURRENT_LEVEL}-level, sorry" diff --git a/hooks/post-command b/hooks/post-command index 1ad5d82..a7ed1f9 100755 --- a/hooks/post-command +++ b/hooks/post-command @@ -22,7 +22,27 @@ elif [ "${LEVEL}" = 'file' ] && [ -z "$(plugin_read_config MANIFEST)" ]; then exit 1 fi -KEY=$(build_key "${LEVEL}" "${CACHE_PATH}") +COMPRESS=$(plugin_read_config COMPRESSION 'none') +if ! validate_compression "${COMPRESS}"; then + echo "+++ 🚨 Invalid value for compression option" + exit 1 +fi + +KEY=$(build_key "${LEVEL}" "${CACHE_PATH}" "${COMPRESS}") + +if [ "${COMPRESS}" = 'tgz' ]; then + COMPRESS_COMMAND=(tar czf) +elif [ "${COMPRESS}" = 'zip' ]; then + COMPRESS_COMMAND=(zip) +fi + +if [ "${COMPRESS}" != 'none' ]; then + echo "Compressing ${CACHE_PATH} with ${COMPRESS}..." + ACTUAL_PATH=$(mktemp) + "${COMPRESS_COMMAND[@]}" "${ACTUAL_PATH}" "${CACHE_PATH}" +else + ACTUAL_PATH="${CACHE_PATH}" +fi echo "Saving ${LEVEL}-level cache of ${CACHE_PATH}" -backend_exec save "${KEY}" "${CACHE_PATH}" \ No newline at end of file +backend_exec save "${KEY}" "${ACTUAL_PATH}" \ No newline at end of file diff --git a/lib/shared.bash b/lib/shared.bash index 006baeb..2ee3185 100644 --- a/lib/shared.bash +++ b/lib/shared.bash @@ -36,7 +36,7 @@ hash_files() { build_key() { local LEVEL="$1" local CACHE_PATH="$2" - local BASE + local COMPRESSION="${3:-}" if [ "${LEVEL}" = 'file' ]; then BASE="$(hash_files "$(plugin_read_config MANIFEST)")" @@ -53,7 +53,7 @@ build_key() { exit 1 fi - echo "cache-${LEVEL}-${BASE}-${CACHE_PATH}" | "$(sha)" | cut -d\ -f1 + echo "cache-${LEVEL}-${BASE}-${CACHE_PATH}-${COMPRESSION}" | "$(sha)" | cut -d\ -f1 } backend_exec() { @@ -61,4 +61,17 @@ backend_exec() { BACKEND_NAME=$(plugin_read_config BACKEND 'fs') PATH="${PATH}:${DIR}/../backends" "cache_${BACKEND_NAME}" "$@" +} + +validate_compression() { + local COMPRESSION="$1" + + VALID_COMPRESSIONS=(none tgz zip) + for VALID in "${VALID_COMPRESSIONS[@]}"; do + if [ "${COMPRESSION}" = "${VALID}" ]; then + return 0 + fi + done + + return 1 } \ No newline at end of file diff --git a/plugin.yml b/plugin.yml index f1657f5..30c7f7b 100644 --- a/plugin.yml +++ b/plugin.yml @@ -6,10 +6,16 @@ configuration: properties: backend: type: string - path: + compression: type: string + enum: + - zip + - tar + - tgz manifest: type: string + path: + type: string restore: type: string enum: diff --git a/tests/post-checkout-tgz.bats b/tests/post-checkout-tgz.bats new file mode 100644 index 0000000..9e07e57 --- /dev/null +++ b/tests/post-checkout-tgz.bats @@ -0,0 +1,157 @@ +#!/usr/bin/env bats + +# To debug stubs, uncomment these lines: +# export CACHE_DUMMY_STUB_DEBUG=/dev/tty +# export TAR_STUB_DEBUG=/dev/tty + +setup() { + load "${BATS_PLUGIN_PATH}/load.bash" + + mkdir -p tests/data/my_files + echo "all the llamas" > "tests/data/my_files/llamas.txt" + echo "no alpacas" > "tests/data/my_files/alpacas.txt" + + export BUILDKITE_PLUGIN_CACHE_BACKEND=dummy + export BUILDKITE_PLUGIN_CACHE_COMPRESSION=tgz + export BUILDKITE_PLUGIN_CACHE_PATH=tests/data/my_files + export BUILDKITE_PLUGIN_CACHE_MANIFEST=tests/data/my_files/llamas.txt + + # necessary for key-calculations + export BUILDKITE_LABEL="step-label" + export BUILDKITE_BRANCH="tests" + export BUILDKITE_ORGANIZATION_SLUG="bk-cache-test" + export BUILDKITE_PIPELINE_SLUG="cache-pipeline" + + # stub is the same for all tests + stub tar \ + "xzf \* \* : echo uncompressed \$2 into \$3" +} + +teardown() { + rm -rf tests/data + + unstub tar +} + +@test 'Existing file-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=file + + stub cache_dummy \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at file level' + assert_output --partial 'Cache is compressed, uncompressing...' + + unstub cache_dummy +} + +@test 'Existing file-based restore even when max-level is higher' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=all + + stub cache_dummy \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at file level' + assert_output --partial 'Cache is compressed, uncompressing...' + + unstub cache_dummy +} + +@test 'Existing step-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=step + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at step level' + assert_output --partial 'Cache is compressed, uncompressing...' + + unstub cache_dummy +} + +@test 'Existing branch-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=branch + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at branch level' + assert_output --partial 'Cache is compressed, uncompressing...' + + unstub cache_dummy +} +@test 'Existing pipeline-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=pipeline + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at pipeline level' + assert_output --partial 'Cache is compressed, uncompressing...' + + unstub cache_dummy +} + +@test 'Existing all-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=all + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at all level' + assert_output --partial 'Cache is compressed, uncompressing...' + + unstub cache_dummy +} + +@test 'Existing lower level restore works' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=all + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at branch level' + assert_output --partial 'Cache is compressed, uncompressing...' + + unstub cache_dummy +} \ No newline at end of file diff --git a/tests/post-checkout-zip.bats b/tests/post-checkout-zip.bats new file mode 100644 index 0000000..c5cbb3d --- /dev/null +++ b/tests/post-checkout-zip.bats @@ -0,0 +1,158 @@ +#!/usr/bin/env bats + +# To debug stubs, uncomment these lines: +# export CACHE_DUMMY_STUB_DEBUG=/dev/tty +# export UNZIP_STUB_DEBUG=/dev/tty + +setup() { + load "${BATS_PLUGIN_PATH}/load.bash" + + mkdir -p tests/data/my_files + echo "all the llamas" > "tests/data/my_files/llamas.txt" + echo "no alpacas" > "tests/data/my_files/alpacas.txt" + + export BUILDKITE_PLUGIN_CACHE_BACKEND=dummy + export BUILDKITE_PLUGIN_CACHE_COMPRESSION=zip + export BUILDKITE_PLUGIN_CACHE_PATH=tests/data/my_files + export BUILDKITE_PLUGIN_CACHE_MANIFEST=tests/data/my_files/llamas.txt + + # necessary for key-calculations + export BUILDKITE_LABEL="step-label" + export BUILDKITE_BRANCH="tests" + export BUILDKITE_ORGANIZATION_SLUG="bk-cache-test" + export BUILDKITE_PIPELINE_SLUG="cache-pipeline" + + # stub is the same for all tests + stub unzip \ + "\* \* : echo uncompressed \$2 into \$3" +} + +teardown() { + rm -rf tests/data + + unstub unzip +} + +@test 'Existing file-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=file + + stub cache_dummy \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at file level' + assert_output --partial "Cache is compressed, uncompressing..." + + unstub cache_dummy +} + +@test 'Existing file-based restore even when max-level is higher' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=all + + stub cache_dummy \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at file level' + assert_output --partial "Cache is compressed, uncompressing..." + + unstub cache_dummy +} + +@test 'Existing step-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=step + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at step level' + assert_output --partial "Cache is compressed, uncompressing..." + + unstub cache_dummy +} + +@test 'Existing branch-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=branch + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at branch level' + assert_output --partial "Cache is compressed, uncompressing..." + + unstub cache_dummy +} +@test 'Existing pipeline-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=pipeline + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at pipeline level' + assert_output --partial "Cache is compressed, uncompressing..." + + unstub cache_dummy +} + +@test 'Existing all-based restore' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=all + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at all level' + assert_output --partial "Cache is compressed, uncompressing..." + + unstub cache_dummy +} + + +@test 'Existing lower level restore works' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=all + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at branch level' + assert_output --partial "Cache is compressed, uncompressing..." + + unstub cache_dummy +} \ No newline at end of file diff --git a/tests/post-checkout.bats b/tests/post-checkout.bats index 253d3a1..07d0ae4 100644 --- a/tests/post-checkout.bats +++ b/tests/post-checkout.bats @@ -50,6 +50,16 @@ teardown() { assert_output --partial 'Invalid cache level' } +@test "Invalid compression level fails" { + export BUILDKITE_PLUGIN_CACHE_RESTORE=all + export BUILDKITE_PLUGIN_CACHE_COMPRESSION=invalid + + run "$PWD/hooks/post-checkout" + + assert_failure + assert_output --partial 'Invalid value for compression option' +} + @test 'File-based cache with no manifest fails' { export BUILDKITE_PLUGIN_CACHE_RESTORE=file unset BUILDKITE_PLUGIN_CACHE_MANIFEST @@ -234,7 +244,7 @@ teardown() { unstub cache_dummy } -@test 'Existing all-based restore does nothing' { +@test 'Existing all-based restore' { export BUILDKITE_PLUGIN_CACHE_RESTORE=all stub cache_dummy \ @@ -250,5 +260,22 @@ teardown() { assert_success assert_output --partial 'Cache hit at all level' + unstub cache_dummy +} + +@test 'Existing lower level restore works' { + export BUILDKITE_PLUGIN_CACHE_RESTORE=all + + stub cache_dummy \ + 'exists \* : exit 1' \ + 'exists \* : exit 1' \ + 'exists \* : exit 0' \ + "get \* \* : echo restoring \$2 to \$3" + + run "$PWD/hooks/post-checkout" + + assert_success + assert_output --partial 'Cache hit at branch level' + unstub cache_dummy } \ No newline at end of file diff --git a/tests/post-command-tgz.bats b/tests/post-command-tgz.bats new file mode 100644 index 0000000..bedf7df --- /dev/null +++ b/tests/post-command-tgz.bats @@ -0,0 +1,88 @@ +#!/usr/bin/env bats + +# To debug stubs, uncomment these lines: +# export CACHE_DUMMY_STUB_DEBUG=/dev/tty +# export TAR_STUB_DEBUG=/dev/tty + +setup() { + load "${BATS_PLUGIN_PATH}/load.bash" + + mkdir -p tests/data/my_files + echo "all the llamas" > "tests/data/my_files/llamas.txt" + echo "no alpacas" > "tests/data/my_files/alpacas.txt" + + export BUILDKITE_PLUGIN_CACHE_BACKEND=dummy + export BUILDKITE_PLUGIN_CACHE_COMPRESSION=tgz + export BUILDKITE_PLUGIN_CACHE_PATH=tests/data/my_files + + # necessary for key-calculations + export BUILDKITE_LABEL="step-label" + export BUILDKITE_BRANCH="tests" + export BUILDKITE_ORGANIZATION_SLUG="bk-cache-test" + export BUILDKITE_PIPELINE_SLUG="cache-pipeline" + + # stubs are the same for every test + stub cache_dummy \ + "save \* \* : echo saving \$3 in \$2" + + stub tar \ + "czf \* \* : echo compressed \$2 into \$3" +} + +teardown() { + rm -rf tests/data + + unstub cache_dummy + unstub tar +} + +@test "File-level saving with compression" { + export BUILDKITE_PLUGIN_CACHE_SAVE=file + export BUILDKITE_PLUGIN_CACHE_MANIFEST=tests/data/my_files/llamas.txt + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving file-level cache' + assert_output --partial 'Compressing tests/data/my_files with tgz' +} + +@test "Step-level saving" { + export BUILDKITE_PLUGIN_CACHE_SAVE=step + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving step-level cache' + assert_output --partial 'Compressing tests/data/my_files with tgz' +} + +@test "Branch-level saving" { + export BUILDKITE_PLUGIN_CACHE_SAVE=branch + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving branch-level cache' + assert_output --partial 'Compressing tests/data/my_files with tgz' +} + +@test "Pipeline-level saving" { + export BUILDKITE_PLUGIN_CACHE_SAVE=pipeline + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving pipeline-level cache' + assert_output --partial 'Compressing tests/data/my_files with tgz' +} + +@test "All-level saving" { + export BUILDKITE_PLUGIN_CACHE_SAVE=all + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving all-level cache' + assert_output --partial 'Compressing tests/data/my_files with tgz' +} \ No newline at end of file diff --git a/tests/post-command-zip.bats b/tests/post-command-zip.bats new file mode 100644 index 0000000..d8e4390 --- /dev/null +++ b/tests/post-command-zip.bats @@ -0,0 +1,88 @@ +#!/usr/bin/env bats + +# To debug stubs, uncomment these lines: +# export CACHE_DUMMY_STUB_DEBUG=/dev/tty +# export ZIP_STUB_DEBUG=/dev/tty + +setup() { + load "${BATS_PLUGIN_PATH}/load.bash" + + mkdir -p tests/data/my_files + echo "all the llamas" > "tests/data/my_files/llamas.txt" + echo "no alpacas" > "tests/data/my_files/alpacas.txt" + + export BUILDKITE_PLUGIN_CACHE_BACKEND=dummy + export BUILDKITE_PLUGIN_CACHE_COMPRESSION=zip + export BUILDKITE_PLUGIN_CACHE_PATH=tests/data/my_files + + # necessary for key-calculations + export BUILDKITE_LABEL="step-label" + export BUILDKITE_BRANCH="tests" + export BUILDKITE_ORGANIZATION_SLUG="bk-cache-test" + export BUILDKITE_PIPELINE_SLUG="cache-pipeline" + + # stubs are the same for every test + stub cache_dummy \ + "save \* \* : echo saving \$3 in \$2" + + stub zip \ + "echo compressed \${@:2} into \$1" +} + +teardown() { + rm -rf tests/data + + unstub cache_dummy + unstub zip +} + +@test "File-level saving with compression" { + export BUILDKITE_PLUGIN_CACHE_SAVE=file + export BUILDKITE_PLUGIN_CACHE_MANIFEST=tests/data/my_files/llamas.txt + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving file-level cache' + assert_output --partial 'Compressing tests/data/my_files with zip' +} + +@test "Step-level saving" { + export BUILDKITE_PLUGIN_CACHE_SAVE=step + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving step-level cache' + assert_output --partial 'Compressing tests/data/my_files with zip' +} + +@test "Branch-level saving" { + export BUILDKITE_PLUGIN_CACHE_SAVE=branch + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving branch-level cache' + assert_output --partial 'Compressing tests/data/my_files with zip' +} + +@test "Pipeline-level saving" { + export BUILDKITE_PLUGIN_CACHE_SAVE=pipeline + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving pipeline-level cache' + assert_output --partial 'Compressing tests/data/my_files with zip' +} + +@test "All-level saving" { + export BUILDKITE_PLUGIN_CACHE_SAVE=all + + run "$PWD/hooks/post-command" + + assert_success + assert_output --partial 'Saving all-level cache' + assert_output --partial 'Compressing tests/data/my_files with zip' +} \ No newline at end of file diff --git a/tests/post-command.bats b/tests/post-command.bats index 3856881..942cca6 100644 --- a/tests/post-command.bats +++ b/tests/post-command.bats @@ -49,6 +49,16 @@ teardown() { assert_output --partial 'Invalid cache level' } +@test "Invalid compression level fails" { + export BUILDKITE_PLUGIN_CACHE_SAVE=all + export BUILDKITE_PLUGIN_CACHE_COMPRESSION=invalid + + run "$PWD/hooks/post-command" + + assert_failure + assert_output --partial 'Invalid value for compression option' +} + @test "File-based cache with no manifest fails" { export BUILDKITE_PLUGIN_CACHE_SAVE=file diff --git a/tests/shared.bats b/tests/shared.bats index 2614490..00e6e28 100644 --- a/tests/shared.bats +++ b/tests/shared.bats @@ -134,4 +134,39 @@ teardown() { rm -rf test.folder rm -rf FOLDER +} + +@test 'build_key with compression changes' { + run build_key file FOLDER + + assert_success + EMPTY_KEY="${output}" + + run build_key file FOLDER '' + assert_success + assert_output "${EMPTY_KEY}" + + run build_key file FOLDER something + + assert_success + GENERATED_KEY="${output}" + + run build_key file FOLDER another_thing + assert_success + refute_output "${GENERATED_KEY}" +} + +@test 'validate_compression works' { + run validate_compression none + + assert_success + + run validate_compression tgz + assert_success + + run validate_compression zip + assert_success + + run validate_compression invalid + assert_failure } \ No newline at end of file