Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fzf selection for config files #4725

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading