Skip to content

Commit

Permalink
E2E fzf Test Selection Autocompletion (#3313)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Mar 21, 2023
1 parent cbb6859 commit 89ecf25
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ make e2e-test entrypoint=TestInterchainAccountsTestSuite test=TestMsgSubmitTx_Su

If `jq` is installed, you only need to specify the `test`.

If `fzf` is also installed, you only need to run `make e2e-test` and you will be prompted with interactive test selection.

```sh
make e2e-test test=TestMsgSubmitTx_SuccessfulTransfer
```
Expand Down
20 changes: 20 additions & 0 deletions e2e/scripts/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ set -eo pipefail
TEST="${1}"
ENTRY_POINT="${2:-}"

# _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 [ -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.
elif command -v fzf > /dev/null && command -v jq > /dev/null; then
cd ..
go run -mod=readonly cmd/build_test_matrix/main.go | jq -r '.include[] | .test' | fzf
cd - > /dev/null
else
echo "TEST was not provided and both fzf and jq are not present. Unable to determine which test should be used."
exit 1
fi
}

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

# if jq is installed, we can automatically determine the test entrypoint.
if command -v jq > /dev/null; then
cd ..
Expand Down

0 comments on commit 89ecf25

Please sign in to comment.