Skip to content

Commit

Permalink
add bats lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jrschumacher committed Aug 23, 2024
1 parent bc0fa0e commit 70cd52a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
end-to-end:
name: e2e tests
runs-on: ubuntu-22.04
env:
BATS_LIB_PATH: /usr/lib
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Check out platform
Expand Down
29 changes: 17 additions & 12 deletions tests/profile.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ setup() {

OTDFCTL_BIN=./otdfctl_testbuild

# Check if BATS_SUPPORT_PATH environment variable exists
if [ -z "${BATS_SUPPORT_PATH}" ]; then
# Check if bats is installed via homebrew
if [[ $(which bats) == *"/homebrew/"* ]]; then
FINAL_BATS_SUPPORT_PATH=$(brew --prefix)/lib
else
FINAL_BATS_SUPPORT_PATH=$(dirname $(which bats))/../lib
if [[ $(which bats) == *"homebrew"* ]]; then
BATS_LIB_PATH=$(brew --prefix)/lib
fi

# Check if BATS_LIB_PATH environment variable exists
if [ -z "${BATS_LIB_PATH}" ]; then
# Check if bats bin has homebrew in path name
if [[ $(which bats) == *"homebrew"* ]]; then
BATS_LIB_PATH=$(dirname $(which bats))/../lib
elif [ -d "/usr/lib/bats-support" ]; then
BATS_LIB_PATH="/usr/lib"
elif [ -d "/usr/local/lib/bats-support" ]; then
# Check if bats-support exists in /usr/local/lib
BATS_LIB_PATH="/usr/local/lib"
fi
else
FINAL_BATS_SUPPORT_PATH="${BATS_SUPPORT_PATH}"
fi
echo "FINAL_BATS_SUPPORT_PATH: $FINAL_BATS_SUPPORT_PATH"
load "${FINAL_BATS_SUPPORT_PATH}/bats-support/load.bash"
load "${FINAL_BATS_SUPPORT_PATH}/bats-assert/load.bash"
echo "BATS_LIB_PATH: $BATS_LIB_PATH"
load "${BATS_LIB_PATH}/bats-support/load.bash"
load "${BATS_LIB_PATH}/bats-assert/load.bash"

set_test_profile() {
auth=""
Expand Down

0 comments on commit 70cd52a

Please sign in to comment.