Skip to content

Commit

Permalink
BATS: Bump submodules
Browse files Browse the repository at this point in the history
Only bats-core has changed; the relevant change is the fix for multiple
slashes in the test name for `--gather-test-output-in`.  However, the bump
also exposed issues where we had unset variables (BAT previous broke usage
of `-o nounset`).

Signed-off-by: Mark Yen <[email protected]>
  • Loading branch information
mook-as committed Feb 7, 2024
1 parent 92dac8f commit 5d2e661
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
[submodule "bats/bats-core"]
path = bats/bats-core
url = https://github.com/rancher-sandbox/bats-core.git
branch = master
[submodule "bats/bats-assert"]
path = bats/bats-assert
url = https://github.com/rancher-sandbox/bats-assert.git
branch = master
[submodule "bats/bats-support"]
path = bats/bats-support
url = https://github.com/rancher-sandbox/bats-support.git
branch = master
[submodule "bats/bats-file"]
path = bats/bats-file
url = https://github.com/rancher-sandbox/bats-file.git
branch = master
8 changes: 6 additions & 2 deletions bats/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ To test the Windows-based tools, set `RD_USE_WINDOWS_EXE` to `true` before runni

### RD_LOCATION

By default bats will use Rancher Desktop installed in a "system" location. If that doesn't exists, it will try a "user" location, followed by the local "dist" directory inside the local git directory. The final option if is to use "npm". On Linux there is no "user" location.
By default bats will use Rancher Desktop installed in a "system" location. If
that doesn't exists, it will try a "user" location, followed by the local "dist"
directory inside the local git directory. The final option if none of the above
apply is to use "dev", which uses `npm run dev`. On Linux there is no "user"
location.

You can explicitly request a specific install location by setting `RD_LOCATION` to `system`, `user`, `dist`, or `npm`:
You can explicitly request a specific install location by setting `RD_LOCATION` to `system`, `user`, `dist`, or `dev`:

```
cd bats
Expand Down
9 changes: 7 additions & 2 deletions bats/tests/helpers/load.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ RD_TEST_FILENAME=${RD_TEST_FILENAME%.bats}

# Use fatal() to abort loading helpers; don't run any tests
fatal() {
echo " $1" >&3
# fd 3 might not be open if we're not fully under bats yet; detect that.
if [[ -e /dev/fd/3 ]]; then
echo " $1" >&3
else
echo " $1" >&2
fi
exit 1
}

Expand Down Expand Up @@ -88,7 +93,7 @@ teardown_file() {
if is_linux || is_windows; then
# On Linux & Windows if we don't shutdown Rancher Desktop bats tests don't terminate.
shutdown=true
elif [[ $RD_LOCATION == dev ]]; then
elif using_dev_mode; then
# In dev mode, we also need to shut down.
shutdown=true
elif using_ramdisk; then
Expand Down
4 changes: 2 additions & 2 deletions bats/tests/helpers/paths.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ set_path_resources() {
local dist=$3
local subdir=$4

if [ -z "$RD_LOCATION" ]; then
if [ -z "${RD_LOCATION:-}" ]; then
if [ -d "$system" ]; then
RD_LOCATION=system
elif [ -d "$user" ]; then
RD_LOCATION=user
elif [ -d "$dist" ]; then
RD_LOCATION=dist
elif inside_repo_clone; then
RD_LOCATION=npm
RD_LOCATION=dev
else
(
echo "Couldn't locate Rancher Desktop in"
Expand Down

0 comments on commit 5d2e661

Please sign in to comment.