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

Update make e2e test so that you only need the test name #3281

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: 1 addition & 1 deletion .github/workflows/e2e-compatibility-workflow-call.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Run e2e Test
run: |
cd e2e
make e2e-test entrypoint=${{ matrix.entrypoint }} test=${{ matrix.test }}
make e2e-test test=${{ matrix.test }}
env:
# each test has its own set of variables to specify which images are used.
CHAIN_IMAGE: "${{ matrix.chain-image }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
- name: Run e2e Test
run: |
cd e2e
make e2e-test entrypoint=${{ matrix.entrypoint }} test=${{ matrix.test }}
make e2e-test test=${{ matrix.test }}
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test-workflow-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jobs:
id: e2e_test
run: |
cd e2e
make e2e-test entrypoint=${{ matrix.entrypoint }} test=${{ matrix.test }}
make e2e-test test=${{ matrix.test }}
- name: Upload Diagnostics
uses: actions/upload-artifact@v3
if: ${{ failure() && inputs.upload-logs }}
Expand Down
2 changes: 1 addition & 1 deletion e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cleanup-ibc-test-containers:
done

e2e-test: cleanup-ibc-test-containers
./scripts/run-e2e.sh $(entrypoint) $(test)
./scripts/run-e2e.sh $(test) $(entrypoint)

compatibility-tests:
./scripts/run-compatibility-tests.sh $(release_branch)
Expand Down
6 changes: 6 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ export RELAYER_TAG="v2.0.0"
make e2e-test entrypoint=TestInterchainAccountsTestSuite test=TestMsgSubmitTx_SuccessfulTransfer
```

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

```sh
make e2e-test test=TestMsgSubmitTx_SuccessfulTransfer
```

> Note: sometimes it can be useful to make changes to [ibctest](https://github.com/strangelove-ventures/interchaintest) when running tests locally. In order to do this, add the following line to
e2e/go.mod

Expand Down
24 changes: 20 additions & 4 deletions e2e/scripts/run-e2e.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
#!/bin/bash

set -euo pipefail
set -eo pipefail

ENTRY_POINT="${1}"
TEST="${2}"
TEST="${1}"
ENTRY_POINT="${2:-}"
Comment on lines +5 to +6
Copy link
Contributor Author

@chatton chatton Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TEST is required, but ENTRY_POINT is not


export CHAIN_A_TAG="${CHAIN_A_TAG:-main}"
export CHAIN_IMAGE="${CHAIN_IMAGE:-ghcr.io/cosmos/ibc-go-simd}"
export CHAIN_BINARY="${CHAIN_BINARY:-simd}"

go test -v ./tests/... --run ${ENTRY_POINT} -testify.m ^${TEST}$
# if jq is installed, we can automatically determine the test entrypoint.
if command -v jq > /dev/null; then
cd ..
ENTRY_POINT="$(go run -mod=readonly cmd/build_test_matrix/main.go | jq -r --arg TEST "${TEST}" '.include[] | select( .test == $TEST) | .entrypoint')"
cd - > /dev/null
fi


# find the name of the file that has this test in it.
test_file="$(grep --recursive --files-with-matches './' -e "${TEST}()")"

# we run the test on the directory as specific files may reference types in other files but within the package.
test_dir="$(dirname $test_file)"

# run the test file directly, this allows log output to be streamed directly in the terminal sessions
# without needed to wait for the test to finish.
go test -v "${test_dir}" --run ${ENTRY_POINT} -testify.m ^${TEST}$