Skip to content

Commit

Permalink
Update github-config to 27eb427
Browse files Browse the repository at this point in the history
  • Loading branch information
paketo-bot authored and paketo-bot committed Sep 14, 2020
1 parent 6a18287 commit 7811472
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion scripts/.util/print.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ function util::print::success() {
reset="\033[0;39m"

echo -e "${green}${message}${reset}" >&2
exit 0
exitcode="${2:-0}"
exit "${exitcode}"
}

function util::print::warn() {
Expand Down
10 changes: 10 additions & 0 deletions scripts/.util/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,13 @@ function util::tools::packager::install () {
GOBIN="${dir}" go get -u github.com/cloudfoundry/libcfbuildpack/packager
fi
}

function util::tools::tests::checkfocus() {
testout="${1}"
if grep -q 'Focused: [1-9]' "${testout}"; then
echo "Detected Focused Test(s) - setting exit code to 197"
rm "${testout}"
util::print::success "** GO Test Succeeded **" 197
fi
rm "${testout}"
}
5 changes: 4 additions & 1 deletion scripts/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ function token::fetch() {

function tests::run() {
util::print::title "Run Buildpack Runtime Integration Tests"

testout=$(mktemp)
pushd "${BUILDPACKDIR}" > /dev/null
if GOMAXPROCS="${GOMAXPROCS:-4}" go test -count=1 -timeout 0 ./integration/... -v -run Integration; then
if GOMAXPROCS="${GOMAXPROCS:-4}" go test -count=1 -timeout 0 ./integration/... -v -run Integration | tee "${testout}"; then
util::tools::tests::checkfocus "${testout}"
util::print::success "** GO Test Succeeded **"
else
util::print::error "** GO Test Failed **"
Expand Down
7 changes: 6 additions & 1 deletion scripts/unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ set -o pipefail
readonly PROGDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly BUILDPACKDIR="$(cd "${PROGDIR}/.." && pwd)"

# shellcheck source=SCRIPTDIR/.util/tools.sh
source "${PROGDIR}/.util/tools.sh"

# shellcheck source=SCRIPTDIR/.util/print.sh
source "${PROGDIR}/.util/print.sh"

Expand Down Expand Up @@ -45,8 +48,10 @@ USAGE
function unit::run() {
util::print::title "Run Buildpack Unit Tests"

testout=$(mktemp)
pushd "${BUILDPACKDIR}" > /dev/null
if go test ./... -v -run Unit; then
if go test ./... -v -run Unit | tee "${testout}"; then
util::tools::tests::checkfocus "${testout}"
util::print::success "** GO Test Succeeded **"
else
util::print::error "** GO Test Failed **"
Expand Down

0 comments on commit 7811472

Please sign in to comment.