Skip to content

Commit

Permalink
chore: add fzf selection for config files (#4725)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Sep 20, 2023
1 parent 6611fc3 commit 3120335
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ coverage.txt
profile.out
sim_log_file
e2e/diagnostics
e2e/dev-configs


# Vagrant
.vagrant/
Expand Down
20 changes: 19 additions & 1 deletion e2e/scripts/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,23 @@ function _verify_dependencies() {
_verify_jq
}


# _select_test_config lets you dynamically select a test config for the specific test.
function _select_test_config() {
# if an argument is provided, it is used directly. This enables the drop down selection with fzf.
if [ -n "${1:-}" ]; then
echo "$1"
return
else
ls -1 dev-configs | fzf
fi
}

# _get_test returns the test that should be used in the e2e test. If an argument is provided, that argument
# is returned. Otherwise, fzf is used to interactively choose from all available tests.
function _get_test(){
# if an argument is provided, it is used directly. This enables the drop down selection with fzf.
if [ -n "$1" ]; then
if [ -n "${1:-}" ]; then
echo "$1"
return
# if fzf and jq are installed, we can use them to provide an interactive mechanism to select from all available tests.
Expand All @@ -45,6 +57,12 @@ function _get_test(){

_verify_dependencies

# if the dev configs directory is present, enable fzf completion to select a test config file to use.
if [[ -d "dev-configs" ]]; then
export E2E_CONFIG_PATH="$(pwd)/dev-configs/$(_select_test_config)"
echo "Using configuration file at ${E2E_CONFIG_PATH}"
fi

# if test is set, that is used directly, otherwise the test can be interactively provided if fzf is installed.
TEST="$(_get_test ${TEST})"

Expand Down

0 comments on commit 3120335

Please sign in to comment.