-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for picking RD_LOCATION for BATS
Choose from system/user/dist/npm or pick first available. dist and npm only work when running from inside a git clone. npm is not yet supported on Windows. Also move "load ../helpers/load" from setup() to top level, so we can abort on fatal errors. Predefine teardown_file() with `rdctl shutdown` so it doesn't have to be repeated in every test file. Signed-off-by: Jan Dubois <jan.dubois@suse.com>
- Loading branch information
Showing
21 changed files
with
209 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
setup() { | ||
load '../helpers/load' | ||
} | ||
load '../helpers/load' | ||
|
||
@test 'factory reset' { | ||
factory_reset | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
setup() { | ||
load '../helpers/load' | ||
} | ||
load '../helpers/load' | ||
|
||
@test 'factory reset' { | ||
factory_reset | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,42 @@ | ||
validate_enum() { | ||
local var=$1 | ||
shift | ||
for value in "$@"; do | ||
if [ "${!var}" = "$value" ]; then | ||
return | ||
fi | ||
done | ||
fatal "$var=${!var} is not a valid setting; select from [$*]" | ||
} | ||
|
||
: "${RD_CONTAINER_ENGINE:=containerd}" | ||
validate_enum RD_CONTAINER_ENGINE containerd moby | ||
|
||
: "${RD_KUBERNETES_VERSION:=1.23.6}" | ||
: "${RD_KUBERNETES_PREV_VERSION:=1.22.7}" | ||
: "${RD_RANCHER_IMAGE_TAG:=v2.7.0}" | ||
|
||
: "${RD_USE_IMAGE_ALLOW_LIST:=false}" | ||
: "${RD_USE_WINDOWS_EXE:=false}" | ||
|
||
# RD_LOCATION specifies the location where Rancher Desktop is installed | ||
# system: default system-wide install location shared for all users | ||
# user: per-user install location | ||
# dist: use the result of `npm run package` in ../dist | ||
# npm: dev mode; start app with `cd ..; npm run dev` | ||
# "": use first location from the list above that contains the app | ||
|
||
: "${RD_LOCATION:=}" | ||
validate_enum RD_LOCATION system user dist npm "" | ||
|
||
using_npm_run_dev() { | ||
[ "$RD_LOCATION" = "npm" ] | ||
} | ||
|
||
using_image_allow_list() { | ||
is_true "$RD_USE_IMAGE_ALLOW_LIST" | ||
} | ||
|
||
using_windows_exe() { | ||
is_true "$RD_USE_WINDOWS_EXE" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
load load.bash | ||
|
||
# This file exists to print information about the configuration just once, e.g. | ||
# | ||
# bats test/helpers/info.bash tests/* | ||
# | ||
# This can't be done during normal `load` operation because then it would be | ||
# printed for every single test run. | ||
|
||
# The info output is wrapped in a dummy test because bats doesn't execute files | ||
# that don't contain at least a single test case. | ||
# | ||
# Also use bash-compatible @test syntax so shellcheck doesn't complain. The file | ||
# uses a `.bash` extension so it is not matched by `tests/*` when running all | ||
# tests; you'll want to run it before all the other tests. | ||
|
||
info() { # @test | ||
echo "Using '$RD_LOCATION' install; resources '$PATH_RESOURCES'" >&3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.