diff --git a/tests/unit/app-json.bats b/tests/unit/app-json.bats index 412fbe020..210b8bde0 100644 --- a/tests/unit/app-json.bats +++ b/tests/unit/app-json.bats @@ -2,11 +2,7 @@ load test_helper setup_file() { - if ! command -v "pack" &>/dev/null; then - add-apt-repository --yes ppa:cncf-buildpacks/pack-cli - apt-get update - apt-get --yes install pack-cli - fi + install_pack } setup() { diff --git a/tests/unit/builder-pack.bats b/tests/unit/builder-pack.bats index 3835fcd03..46e13eeb5 100644 --- a/tests/unit/builder-pack.bats +++ b/tests/unit/builder-pack.bats @@ -3,11 +3,7 @@ load test_helper setup_file() { - if ! command -v "pack" &>/dev/null; then - add-apt-repository --yes ppa:cncf-buildpacks/pack-cli - apt-get update - apt-get --yes install pack-cli - fi + install_pack } setup() { diff --git a/tests/unit/ps-cnb.bats b/tests/unit/ps-cnb.bats index 7d98ba0a6..5abbbb1bd 100644 --- a/tests/unit/ps-cnb.bats +++ b/tests/unit/ps-cnb.bats @@ -3,11 +3,7 @@ load test_helper setup_file() { - if ! command -v "pack" &>/dev/null; then - add-apt-repository --yes ppa:cncf-buildpacks/pack-cli - apt-get update - apt-get --yes install pack-cli - fi + install_pack } setup() { diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index 69ac92f55..254c2d0c0 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -577,3 +577,11 @@ detach_delete_network() { detach_network "$NETWORK_NAME" delete_network "$NETWORK_NAME" } + +install_pack() { + if ! command -v "pack" &>/dev/null; then + add-apt-repository --yes ppa:cncf-buildpacks/pack-cli + apt-get update + apt-get --yes install pack-cli + fi +}