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

Enable Parallel Transfer Test Suite #6721

Merged
merged 218 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 206 commits
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
c07bca9
Adding proto files for ics20-v2 (#6110)
chatton Apr 8, 2024
e66bd89
update amount -> string (#6120)
charleenfei Apr 9, 2024
034f472
Update MsgTransfer to accept sdk.Coins instead of sdk.Coin (#6113)
chatton Apr 9, 2024
4cc6a85
fix: allow base denom with trailing slash (#6148)
Apr 15, 2024
71f830c
imp: add CurrentVersion, EscrowVersion (#6160)
charleenfei Apr 16, 2024
28ff9b6
chore: add function for converting packet data from v1 to v3 (#6116)
chatton Apr 16, 2024
4e55137
chore: implement required `FungibleTokenPacketData` v3 interface meth…
charleenfei Apr 22, 2024
ca056cf
imp: `getMultiDenomFungibleTokenPacketData`to be used in packet unmar…
charleenfei Apr 29, 2024
147cf17
chore: implement version checking for channel handshake application c…
charleenfei May 6, 2024
9bbfa1a
imp: update transfer authz implementation to account for multi denom …
charleenfei May 6, 2024
4f57916
ics20-v2: backwards compatibility for transfer rpc and packet callbac…
May 10, 2024
e04047e
add v3 packet proto
sangier May 10, 2024
c73d5f6
fix protos
sangier May 10, 2024
03cc2e5
fixes
sangier May 10, 2024
65f4476
test fixes
sangier May 10, 2024
db85a29
add forwardPath keys and memo check in sendTransfer
sangier May 13, 2024
999ed80
wip onRecvPacket logic
sangier May 13, 2024
be72180
minor fixes
sangier May 13, 2024
4c333c5
changes to transfer tx CLI to support multiple denoms
May 14, 2024
0478cb9
import renaming
May 14, 2024
37f5b5e
onRecv logic completed
sangier May 14, 2024
3fd3345
add revertInFlights function
sangier May 14, 2024
24e2407
add onAck && onTimeout logic
sangier May 14, 2024
7858528
fix interchain accounts test
May 14, 2024
55d7bf9
basic unit test for path forwarding
May 14, 2024
1a95262
fix test unsuccessful refund from source
sangier May 15, 2024
44e15cb
wip test fix
sangier May 15, 2024
334d5a9
fix mbt test - need more investigation
sangier May 16, 2024
7466b19
revert test fix
sangier May 16, 2024
5c46d79
add assertions
sangier May 16, 2024
99e6b0a
add support for async ack
sangier May 16, 2024
a114af6
wip test forwarding happy path
sangier May 16, 2024
d800caa
icsv20(path forwarding): use nil as default forwarding path when not …
May 17, 2024
dd873a1
add forwarding happy path tests
sangier May 17, 2024
a292a3f
Merge branch 'feat/ics20-v2' into stefano/carlos/ics20-v2-forwarding-poc
sangier May 20, 2024
e25ba0c
fix merge
sangier May 20, 2024
f39d173
Use type with V2 suffix for package data (#6330)
chatton May 21, 2024
9b39944
Adding additional comments and changing version variable names (#6345)
chatton May 21, 2024
06ca9a5
Merge branch 'main' into merge-main
chatton May 21, 2024
7897ef3
chore: correctly claim capability
chatton May 21, 2024
786a4f1
lint
colin-axner May 21, 2024
5747756
Merge pull request #6346 from cosmos/merge-main
DimitrisJim May 21, 2024
7e2e6df
Merge branch 'main' into feat/ics20-v2
chatton May 22, 2024
a84b0e7
imp: change ics20 events to emit token set (#6348)
colin-axner May 22, 2024
43877df
imp: check length tokens array against maximum allowed (#6349)
May 22, 2024
8eae033
Modify UnmarshalPacketData interface to allow additional args (#6341)
DimitrisJim May 22, 2024
dbcff45
Refactor packet data unmarshalling to use specific version (#6354)
chatton May 23, 2024
bb69698
Merge branch 'main' into merge-main-2
chatton May 23, 2024
f19a145
chore: fixing tests
chatton May 23, 2024
8f86dda
Merge pull request #6359 from cosmos/merge-main-2
chatton May 23, 2024
d4b06c8
imp: self review comments for ics20-v2 (#6360)
colin-axner May 23, 2024
a9391a4
imp: self review on ics20-v2 part 2 (#6364)
colin-axner May 23, 2024
575403e
chore: move functions from internal/denom back to trace.go (#6368)
DimitrisJim May 23, 2024
50ccd94
imp: ics20 v2 self review part 3 (#6373)
colin-axner May 23, 2024
87eb32e
chore: remove duplicate test case
colin-axner May 23, 2024
e8b9d5a
chore: address minor nits (#6374)
DimitrisJim May 23, 2024
57aab01
Merge branch 'feat/ics20-v2' into stefano/carlos/ics20-v2-forwarding-poc
May 23, 2024
2519593
fix lint warning, add extra godocs, and some other small fixes and cl…
May 26, 2024
3bf6c04
Merge branch 'main' into stefano/carlos/ics20-v2-forwarding-poc
May 27, 2024
64c2fc4
fix finalReceiver address bug
sangier May 27, 2024
7cd7260
wip - ack test scenario5
sangier May 27, 2024
6673e74
add FungibleTokenPacketDataV2 test for ValidateBasic (#6398)
hastur199 May 28, 2024
550eeef
fix linter complaints
May 28, 2024
4c54a88
add test - currently faling on middle hop revert
sangier May 28, 2024
debc4cb
add test comments
sangier May 28, 2024
e50fa40
fixes
sangier May 28, 2024
6d87d95
Merge branch 'main' into stefano/carlos/ics20-v2-forwarding-poc
May 31, 2024
7c8f516
retrieve channel capability only if there is a previous packet in store
May 31, 2024
feb7b01
Merge branch 'main' into stefano/carlos/ics20-v2-forwarding-poc
Jun 7, 2024
6fd1773
Merge branch 'main' into stefano/carlos/ics20-v2-forwarding-poc
Jun 9, 2024
efcfa5d
add missing parameter
Jun 9, 2024
21dbb37
fix: e2e build failures.
DimitrisJim Jun 10, 2024
70d7a29
Use Transfer instead of sendTransfer when forwarding. (#6564)
DimitrisJim Jun 11, 2024
465b16c
lint: fix linter issues.
DimitrisJim Jun 11, 2024
ec472cf
tests(transfer): move forwarding tests to separate file. (#6568)
DimitrisJim Jun 11, 2024
e483b9a
chore: rename ForwardingInfo to Forwarding
damiannolan Jun 12, 2024
0c9f368
Revert "chore: rename ForwardingInfo to Forwarding"
damiannolan Jun 12, 2024
413b7c1
nit(transfer): Mark hops as non nullable. (#6566)
DimitrisJim Jun 12, 2024
ae2046a
feat(transfer): add forwarding info validation to token packet (#6571)
gjermundgaraba Jun 12, 2024
ba7c4a8
feat(transfer): add validation for forwarding info in msg transfer va…
gjermundgaraba Jun 13, 2024
6b3b5aa
Fix and simplify reverts of forwarding state (#6574)
srdtrk Jun 13, 2024
5070e50
chore: rename ForwardingInfo to Forwarding (#6576)
damiannolan Jun 13, 2024
d874b54
Refactor packet forward functions (#6575)
chatton Jun 13, 2024
a8cd302
Merge branch 'main' into feat/ics20-v2-path-forwarding
Jun 13, 2024
fbb9cd8
feat(transfer): validate forwarding memo in transfer authorization (#…
gjermundgaraba Jun 13, 2024
c4987a7
Add func convert token to coin ibc (#6584)
duonghb53 Jun 14, 2024
a90b671
transfer: Disallow a forwarding object specified with zero hops and a…
DimitrisJim Jun 14, 2024
c348732
feat(transfer): move async decision and handling to the ibc module on…
gjermundgaraba Jun 14, 2024
789b09b
Merge branch 'main' into feat/ics20-v2-path-forwarding
Jun 16, 2024
c00ddd9
chore: use NewForwarding instead of direct init (#6605)
gjermundgaraba Jun 17, 2024
fc6c111
Reduce max forwarding to 16 (#6610)
DimitrisJim Jun 17, 2024
72714b3
feat(transfer): use single byte ack for successful forward (#6604)
gjermundgaraba Jun 17, 2024
c546f69
chore(transfer/cli): add forwarding flag to tx cli (#6609)
DimitrisJim Jun 18, 2024
60a6b99
chore(transfer): make Forwarding non-null (#6618)
DimitrisJim Jun 18, 2024
dc47641
chore: restructure functions with logical ordering (#6638)
damiannolan Jun 18, 2024
832b1bd
test: Add tests for OnTimeoutPacket when middle chain times out packe…
bznein Jun 19, 2024
360b2f8
feat(transfer): add ShouldBeForwarded convenience method to msg trans…
gjermundgaraba Jun 19, 2024
cd45c15
wip: relayer configuration experimentation
chatton Jun 19, 2024
84c7c33
disallow timeout height usage when forwarding packets (#6641)
Jun 19, 2024
007dee1
nit: make set forwarded packet unexported (#6637)
Jun 19, 2024
14d5486
feat(transfer): use registered error code for error acks in token for…
gjermundgaraba Jun 19, 2024
a28a549
chore(transfer): emit forwarding information in events. (#6647)
DimitrisJim Jun 20, 2024
d6db0c5
Merge branch 'main' into gjermund/merge-main-to-feat-ics20-v2-path-fo…
gjermundgaraba Jun 20, 2024
64bc502
Fix e2e test
gjermundgaraba Jun 20, 2024
1ca1f2f
Merge pull request #6662 from cosmos/gjermund/merge-main-to-feat-ics2…
chatton Jun 20, 2024
755b38e
chore: test passing using relayer packet filter
chatton Jun 20, 2024
87d1f91
Refactor forwarding messages for Transfer and Packet (#6655)
DimitrisJim Jun 20, 2024
ef6d22f
feat: allow authz granters to specify forwarding info for token trans…
bznein Jun 21, 2024
da2f9f6
feat: delete forwarded packet when it is not needed anymore (#6621)
bznein Jun 21, 2024
e68143b
test(transfer): forwarding acknowledgment errors in middle hop (#6659)
gjermundgaraba Jun 21, 2024
6619821
test(transfer): last chain in forwarding packet is ICS20 v1 (#6622)
gjermundgaraba Jun 21, 2024
43eceed
refactor: rename SetupPath to SetupPaths (#6674)
gjermundgaraba Jun 24, 2024
5fa4fae
chore: configure the hermes config to watch a specific port and chann…
chatton Jun 24, 2024
aa860ac
chore: add flag for unwind in transfer cli (#6680)
neitdung Jun 24, 2024
8f74d69
chore: small refactor for SetupPath
chatton Jun 24, 2024
5b7cc28
chore: adding link to interchaintest issue and doing some cleanup
chatton Jun 24, 2024
66adec1
chore: adding interchaintest issue link in comment
chatton Jun 24, 2024
2e969c8
Merge branch 'main' into cian/issue#6634-configure-relayers-to-watch-…
chatton Jun 24, 2024
bd8fbe1
chore: merge main
chatton Jun 24, 2024
129fbf8
chore: fix linter
chatton Jun 24, 2024
6f68e9c
chore: sync main
chatton Jun 24, 2024
f0e6ee2
Merge branch 'main' into cian/issue#6634-configure-relayers-to-watch-…
chatton Jun 24, 2024
2b4d24b
feat: impl check reject transfer if len(hops) > 0 and ics20-1 (#6675)
duonghb53 Jun 24, 2024
57baa91
chore: fix go mod
chatton Jun 24, 2024
23ee519
Merge branch 'main' into cian/issue#6634-configure-relayers-to-watch-…
chatton Jun 25, 2024
59e3df7
feat(transfer): add unwinding ability (#6656)
DimitrisJim Jun 25, 2024
e3ffcff
Merge branch 'main' into feat/ics20-v2-path-forwarding
chatton Jun 25, 2024
523c1ae
chore: add support to run full test suite in run-e2e.sh
chatton Jun 25, 2024
d39a795
chore: only store last channel for each test
chatton Jun 25, 2024
694636c
chore: merge relayer branch
chatton Jun 25, 2024
9c5ae03
fix typo
Jun 25, 2024
6a4d128
Merge branch 'main' into cian/issue#6677-update-ci-workflows-to-run-a…
chatton Jun 25, 2024
c2a6bc6
remove unnecessary wrapping of function
Jun 25, 2024
c3ccbfc
Revert "remove unnecessary wrapping of function"
Jun 25, 2024
5345776
fix usage of function
Jun 25, 2024
74088ba
(chore) replace reflect.DeepEqual with slices.Equal (#6697)
bznein Jun 25, 2024
272c12b
chore: comment hop slicing for clarity (#6702)
gjermundgaraba Jun 25, 2024
4349a1d
chore: cleanup forwarding tests (#6691)
Jun 26, 2024
24cd07f
chore: pull out hop validation and consolidate for transfer+packet (#…
gjermundgaraba Jun 26, 2024
dca8c42
Merge branch 'main' into feat/ics20-v2-path-forwarding
chatton Jun 26, 2024
37d7335
Remove unwind field in authz (#6701)
chatton Jun 26, 2024
6e1a082
chore: add packet data validation back (#6704)
chatton Jun 26, 2024
52c2440
chore: misc cleanup in run_e2e.sh
chatton Jun 26, 2024
8f9691f
(chore) Refactor code around forwarding validation (#6706)
bznein Jun 26, 2024
c505243
use setupForwardingPaths in test
Jun 26, 2024
d715455
feat(transfer): allow non-cosmos-sdk AccAddress in final receiver for…
gjermundgaraba Jun 26, 2024
4e61ea9
chore: pass only hops to sendTransfer + events rename (#6703)
gjermundgaraba Jun 26, 2024
3e2a5fa
test: forwarding test that verifies forwarded memo (#6707)
gjermundgaraba Jun 26, 2024
5ea9d79
chore: update godoc for relay forwarding tests
gjermundgaraba Jun 26, 2024
100ccc7
chore: use module account instead of custom forward address (#6688)
gjermundgaraba Jun 26, 2024
13d3ac6
chore: replace continue with if/else (#6700)
Jun 26, 2024
b6d77d7
Merge branch 'main' into feat/ics20-v2-path-forwarding
Jun 27, 2024
4d19be1
add changelog
Jun 27, 2024
2838aef
add test for invalid receiver address
Jun 27, 2024
7afb7f6
Update CHANGELOG.md
Jun 27, 2024
0221c6b
Update CHANGELOG.md
Jun 27, 2024
cc46a63
make getForwardedPacket private
Jun 27, 2024
e67aeaf
remove auxiliary burn coins function
Jun 27, 2024
966a644
nit: rename func method recv args in types/forwarding.go
damiannolan Jun 27, 2024
e92e086
chore: rename ShouldBeForwarded to HasFowarding
damiannolan Jun 27, 2024
6ea614f
e2e: remove template test for three chain setup.
DimitrisJim Jun 27, 2024
18d0567
nit: no generics silly
DimitrisJim Jun 27, 2024
1b7214d
nit: add clarifying comment to validate basic call on msg.
DimitrisJim Jun 27, 2024
1f5e61f
nit: remove unused key.
DimitrisJim Jun 27, 2024
0a78bde
nit: clean up cli help text.
DimitrisJim Jun 27, 2024
07036a9
nit: don't export is blocked address helper.
DimitrisJim Jun 27, 2024
1442874
nit: docustring for e2e test and helper.
DimitrisJim Jun 27, 2024
25c73c4
nit: improve documentation for transfer's OnRecv callback.
DimitrisJim Jun 27, 2024
ea3f84c
chore: move setup code into individual tests
chatton Jun 27, 2024
1e803dc
chore: use custom setup functions in tests that need them
chatton Jun 27, 2024
f17de69
chore: remove unused function
chatton Jun 27, 2024
baf3fd3
Apply suggestions from code review
Jun 27, 2024
7d2a881
chore: remove unused function
Jun 27, 2024
4ea36c2
perf: allocate slice to length of packet data tokens
Jun 27, 2024
0a28e9b
Merge branch 'main' into feat/ics20-v2-path-forwarding
Jun 27, 2024
7411f2d
chore(transfer/authz): wrapf unauthorized forwarding hops
damiannolan Jun 27, 2024
199c14a
lint
Jun 27, 2024
c7af85a
Update modules/apps/transfer/types/forwarding.go
Jun 27, 2024
25239a2
Merge branch 'main' into feat/ics20-v2-path-forwarding
Jun 27, 2024
90d57db
Preallocate slice but keep len==0 (#6725)
bznein Jun 27, 2024
e310e27
imp: validate allowed forwarding hops
Jun 27, 2024
f28e937
test: unwind fails in Transfer rpc
Jun 27, 2024
50daed0
Merge branch 'main' into feat/ics20-v2-path-forwarding
Jun 28, 2024
166c72d
chore: merge main
chatton Jul 1, 2024
400331b
wip: tests failing after merge conflict
chatton Jul 1, 2024
2eca08f
chore: test passing with new config
chatton Jul 1, 2024
3e53dc3
chore: handle merge conflicts
chatton Jul 1, 2024
ddaa142
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 1, 2024
afc6173
wip: working on ensuring existing tests pass
chatton Jul 2, 2024
1041e62
wip: working on ensuring existing tests pass
chatton Jul 2, 2024
912b6cb
chore: revert changes to ibc genesis test
chatton Jul 2, 2024
627de9c
wip: transfer tests passing in parallel
chatton Jul 2, 2024
8162af4
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 2, 2024
c08db61
chore: add comments and max function
chatton Jul 2, 2024
18eca24
chore: fix e2e linting
chatton Jul 3, 2024
7091425
chore: move param tests into their own files
chatton Jul 3, 2024
441ff6d
chore: run transfer test in CI in parallel
chatton Jul 3, 2024
8dd2a0a
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 3, 2024
4cdc4df
chore: tweak run-e2e.sh to not check for fzf
chatton Jul 3, 2024
e70f54e
chore: reference correct env var
chatton Jul 3, 2024
be9d9bb
chore: separate out transfer utility logic from test suite
chatton Jul 3, 2024
b06dbf2
chore: unexporting transfer tester type
chatton Jul 3, 2024
20c59cd
chore: temporarily disable regular E2Es
chatton Jul 3, 2024
1a69474
chore: explicitly run a single test suite
chatton Jul 3, 2024
ba91c33
chore: re-enable regular E2Es and remove redundant start relayer fn
chatton Jul 3, 2024
e7d0520
chore: adding flag to workflow
chatton Jul 3, 2024
48482c1
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 3, 2024
d7fa8dd
chore: correctly store all channels created
chatton Jul 3, 2024
21c2711
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 3, 2024
61c1a81
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 4, 2024
c9949d9
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 4, 2024
2ec8c1a
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 4, 2024
6f195b1
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 4, 2024
d9a7093
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 8, 2024
c7499fd
chore: merge main
chatton Jul 8, 2024
e0f9257
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 8, 2024
cf54298
Merge branch 'main' into cian/enable-parallel-tests
chatton Jul 9, 2024
1a385b6
chore: renaming based on PR feedback
chatton Jul 9, 2024
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
51 changes: 51 additions & 0 deletions .github/workflows/e2e-test-workflow-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
required: false
type: string
default: '' # empty string means run all tests
temp-run-full-suite:
description: 'This flag exists to run a hard coded set of tests and will be phased out'
required: false
type: boolean
default: false
test:
description: 'test name to run as standalone'
required: false
Expand Down Expand Up @@ -253,3 +258,49 @@ jobs:
name: '${{ matrix.entrypoint }}-${{ matrix.test }}'
path: e2e/diagnostics
retention-days: 5

e2e-test-suites:
# temporary flag. eventually this field will not exist and this will be the default.
if: ${{ inputs.temp-run-full-suite }}
runs-on: ubuntu-latest
needs:
- build-test-matrix
- docker-build
- docker-build-wasm
env:
CHAIN_IMAGE: '${{ inputs.chain-image }}'
CHAIN_A_TAG: '${{ inputs.chain-a-tag }}'
CHAIN_B_TAG: '${{ inputs.chain-b-tag }}'
RELAYER_IMAGE: '${{ inputs.relayer-image }}'
RELAYER_TAG: '${{ inputs.relayer-tag }}'
RELAYER_ID: '${{ inputs.relayer-type }}'
CHAIN_BINARY: '${{ inputs.chain-binary }}'
CHAIN_UPGRADE_TAG: '${{ inputs.chain-upgrade-tag }}'
CHAIN_UPGRADE_PLAN: '${{ inputs.upgrade-plan-name }}'
strategy:
fail-fast: false
matrix:
include:
# for now we explicitly specify this test suite.
- entrypoint: TestTransferTestSuite
Comment on lines +283 to +285
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can hard code these in as we transition, and then replace this with the dynamically generated list of tests.

steps:
- uses: actions/checkout@v4
with:
repository: cosmos/ibc-go
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache-dependency-path: 'e2e/go.sum'
- name: Run e2e Test
id: e2e_test
run: |
cd e2e
make e2e-suite entrypoint=${{ matrix.entrypoint }}
Comment on lines +297 to +298
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a copy paste of our existing workflow that just tweaks the make target.

- name: Upload Diagnostics
uses: actions/upload-artifact@v4
if: ${{ failure() && inputs.upload-logs }}
continue-on-error: true
with:
name: '${{ matrix.entrypoint }}-${{ matrix.test }}'
path: e2e/diagnostics
retention-days: 5
4 changes: 3 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ jobs:
chain-b-tag: '${{ needs.determine-image-tag.outputs.simd-tag }}'
chain-binary: 'simd'
# on regular PRs we won't run upgrade tests.
test-exclusions: 'TestUpgradeTestSuite,TestGrandpaTestSuite,TestIBCWasmUpgradeTestSuite'
# NOTE: we are exluding TestTransferTestSuite as we run this full suite instead of each individual test.
test-exclusions: 'TestUpgradeTestSuite,TestGrandpaTestSuite,TestIBCWasmUpgradeTestSuite,TestTransferTestSuite'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we exclude TestTransferTestSuite because we no longer run it as individual tests.

temp-run-full-suite: true
2 changes: 1 addition & 1 deletion e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ e2e-test: init cleanup-ibc-test-containers
./scripts/run-e2e.sh $(test) $(entrypoint)

e2e-suite: init cleanup-ibc-test-containers
RUN_SUITE="true" ./scripts/run-e2e.sh $(test) $(entrypoint)
RUN_SUITE="true" ./scripts/run-e2e.sh "" $(entrypoint)

compatibility-tests:
./scripts/run-compatibility-tests.sh $(release_branch)
Expand Down
26 changes: 17 additions & 9 deletions e2e/scripts/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -eo pipefail

TEST="${1}"
ENTRY_POINT="${2:-}"
TEST="${1:-}"
export ENTRY_POINT="${2:-}"

function _verify_jq() {
if ! command -v jq > /dev/null ; then
Expand All @@ -19,7 +19,7 @@ function _verify_fzf() {
fi
}

function _verify_dependencies() {
function _verify_test_dependencies() {
if [ -z "${TEST}" ]; then
# fzf is only required if we are not explicitly specifying a test.
_verify_fzf
Expand All @@ -28,6 +28,14 @@ function _verify_dependencies() {
_verify_jq
}

function _verify_suite_dependencies() {
if [ -z "${ENTRY_POINT}" ]; then
# fzf is only required if we are not explicitly specifying an entrypoint.
_verify_fzf
fi
# jq is always required to determine the entrypoint of the test.
_verify_jq
}

# _select_test_config lets you dynamically select a test config for the specific test.
function _select_test_config() {
Expand All @@ -51,7 +59,7 @@ function _get_test(){

# run_test runs a single E2E test.
function run_test() {
# if the dev configs directory is present, enable fzf completion to select a test config file to use.
_verify_test_dependencies

# if test is set, that is used directly, otherwise the test can be interactively provided if fzf is installed.
TEST="$(_get_test ${TEST})"
Expand All @@ -78,23 +86,23 @@ function run_test() {

# run_suite runs a full E2E test suite.
function run_suite() {
_verify_suite_dependencies
# if jq is installed, we can automatically determine the test entrypoint.
if command -v jq > /dev/null; then
if [ -z "${ENTRY_POINT}" ]; then
cd ..
ENTRY_POINT="$(go run -mod=readonly cmd/build_test_matrix/main.go | jq -r '.include[] | .entrypoint' | uniq | fzf)"
cd - > /dev/null
fi

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

Choose a reason for hiding this comment

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

[q] why the added extra parentheses?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If multiple tests start with ${ENTRYPOINT} things blow up. E.g.

TestFoo()
TestFooBar()
TestFooBarBaz()

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, it makes sense!

test_dir="$(dirname $test_file)"

# TODO: add the -p flag to run tests in parallel
go test -v "${test_dir}" --run ${ENTRY_POINT} -timeout 30m
go test -v "${test_dir}" --run ^${ENTRY_POINT}$ -timeout 30m -p 10
}

_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}"
Expand Down
24 changes: 17 additions & 7 deletions e2e/tests/core/02-client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() {
t := s.T()
ctx := context.TODO()

testName := t.Name()
s.SetupDefaultPath(testName)

chainA, chainB := s.GetChains()
chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)

Expand Down Expand Up @@ -169,14 +172,15 @@ func (s *ClientTestSuite) TestClientUpdateProposal_Succeeds() {
badTrustingPeriod = time.Second * 10
)

relayer := s.GetRelayer()
testName := t.Name()
relayer := s.SetupDefaultPath(testName)

t.Run("create substitute client with correct trusting period", func(t *testing.T) {
// TODO: update when client identifier created is accessible
// currently assumes first client is 07-tendermint-0
substituteClientID = clienttypes.FormatClientIdentifier(ibcexported.Tendermint, 0)

pathName = s.GetPaths()[0]
pathName = s.GetPaths(testName)[0]
})

chainA, chainB := s.GetChains()
Expand Down Expand Up @@ -249,14 +253,15 @@ func (s *ClientTestSuite) TestRecoverClient_Succeeds() {
badTrustingPeriod = time.Second * 10
)

relayer := s.GetRelayer()
testName := t.Name()
relayer := s.SetupDefaultPath(testName)

t.Run("create substitute client with correct trusting period", func(t *testing.T) {
// TODO: update when client identifier created is accessible
// currently assumes first client is 07-tendermint-0
substituteClientID = clienttypes.FormatClientIdentifier(ibcexported.Tendermint, 0)

pathName = s.GetPaths()[0]
pathName = s.GetPaths(testName)[0]
})

chainA, chainB := s.GetChains()
Expand Down Expand Up @@ -334,13 +339,15 @@ func (s *ClientTestSuite) TestClient_Update_Misbehaviour() {
err error
)

relayer := s.GetRelayer()
testName := t.Name()
relayer := s.SetupDefaultPath(testName)

chainA, chainB := s.GetChains()

s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA, chainB))

t.Run("update clients", func(t *testing.T) {
err := relayer.UpdateClients(ctx, s.GetRelayerExecReporter(), s.GetPaths()[0])
err := relayer.UpdateClients(ctx, s.GetRelayerExecReporter(), s.GetPaths(testName)[0])
s.Require().NoError(err)

clientState, err = query.ClientState(ctx, chainA, ibctesting.FirstClientID)
Expand All @@ -356,7 +363,7 @@ func (s *ClientTestSuite) TestClient_Update_Misbehaviour() {
})

t.Run("update clients", func(t *testing.T) {
err := relayer.UpdateClients(ctx, s.GetRelayerExecReporter(), s.GetPaths()[0])
err := relayer.UpdateClients(ctx, s.GetRelayerExecReporter(), s.GetPaths(testName)[0])
s.Require().NoError(err)

clientState, err = query.ClientState(ctx, chainA, ibctesting.FirstClientID)
Expand Down Expand Up @@ -438,6 +445,9 @@ func (s *ClientTestSuite) TestAllowedClientsParam() {
t := s.T()
ctx := context.TODO()

testName := t.Name()
s.SetupDefaultPath(testName)

chainA, chainB := s.GetChains()
chainAVersion := chainA.Config().Images[0].Version
chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)
Expand Down
9 changes: 5 additions & 4 deletions e2e/tests/core/03-connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type ConnectionTestSuite struct {
testsuite.E2ETestSuite
}

func (s *ConnectionTestSuite) SetupTest() {
s.SetupPaths(ibc.DefaultClientOpts(), s.TransferChannelOptions())
func (s *ConnectionTestSuite) SetupConnectionTestPath(testName string) (ibc.Relayer, ibc.ChannelOutput) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's no longer a lifecycle method, but one we call at the start of tests. the same thing applies for every change of SetupTest

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd love if the name of the method made it clearer what this function is returning, but naming in hard :)

return s.SetupPaths(ibc.DefaultClientOpts(), s.TransferChannelOptions(), testName), s.GetChainAChannelForTest(testName)
}

// QueryMaxExpectedTimePerBlockParam queries the on-chain max expected time per block param for 03-connection
Expand Down Expand Up @@ -65,7 +65,8 @@ func (s *ConnectionTestSuite) TestMaxExpectedTimePerBlockParam() {
t := s.T()
ctx := context.TODO()

relayer, channelA := s.GetRelayer(), s.GetChainAChannel()
testName := t.Name()
relayer, channelA := s.SetupConnectionTestPath(testName)

chainA, chainB := s.GetChains()
chainAVersion := chainA.Config().Images[0].Version
Expand Down Expand Up @@ -126,7 +127,7 @@ func (s *ConnectionTestSuite) TestMaxExpectedTimePerBlockParam() {
})

t.Run("start relayer", func(t *testing.T) {
s.StartRelayer(relayer)
s.StartRelayer(relayer, testName)
})

t.Run("packets are relayed", func(t *testing.T) {
Expand Down
30 changes: 17 additions & 13 deletions e2e/tests/interchain_accounts/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan
t := s.T()
ctx := context.TODO()

// setup relayers and connection-0 between two chains
// channel-0 is a transfer channel but it will not be used in this test case
relayer := s.GetRelayer()
testName := t.Name()
relayer := s.SetupDefaultPath(testName)

chainA, chainB := s.GetChains()

// setup 2 accounts: controller account on chain A, a second chain B account.
Expand All @@ -84,7 +84,7 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan
})

t.Run("start relayer", func(t *testing.T) {
s.StartRelayer(relayer)
s.StartRelayer(relayer, testName)
})

t.Run("verify interchain account", func(t *testing.T) {
Expand Down Expand Up @@ -161,7 +161,9 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_FailedTransfer_InsufficientF
t := s.T()
ctx := context.TODO()

relayer := s.GetRelayer()
testName := t.Name()
relayer := s.SetupDefaultPath(testName)

chainA, chainB := s.GetChains()

// setup 2 accounts: controller account on chain A, a second chain B account.
Expand All @@ -181,7 +183,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_FailedTransfer_InsufficientF
})

t.Run("start relayer", func(t *testing.T) {
s.StartRelayer(relayer)
s.StartRelayer(relayer, testName)
})

t.Run("verify interchain account", func(t *testing.T) {
Expand Down Expand Up @@ -249,7 +251,9 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop
t := s.T()
ctx := context.TODO()

relayer := s.GetRelayer()
testName := t.Name()
relayer := s.SetupDefaultPath(testName)

chainA, chainB := s.GetChains()

// setup 2 accounts: controller account on chain A, a second chain B account.
Expand Down Expand Up @@ -277,7 +281,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop
})

t.Run("start relayer", func(t *testing.T) {
s.StartRelayer(relayer)
s.StartRelayer(relayer, testName)
})

t.Run("verify interchain account", func(t *testing.T) {
Expand Down Expand Up @@ -342,7 +346,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop
})

t.Run("start relayer", func(t *testing.T) {
s.StartRelayer(relayer)
s.StartRelayer(relayer, testName)
})

t.Run("verify channel is closed due to timeout on ordered channel", func(t *testing.T) {
Expand Down Expand Up @@ -436,9 +440,9 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulGovProposal(order c
t := s.T()
ctx := context.TODO()

// setup relayers and connection-0 between two chains
// channel-0 is a transfer channel but it will not be used in this test case
relayer := s.GetRelayer()
testName := t.Name()
relayer := s.SetupDefaultPath(testName)

chainA, chainB := s.GetChains()

// setup 2 accounts: controller account on chain A, a second chain B account.
Expand All @@ -457,7 +461,7 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulGovProposal(order c
})

t.Run("start relayer", func(t *testing.T) {
s.StartRelayer(relayer)
s.StartRelayer(relayer, testName)
})

t.Run("verify interchain account", func(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions e2e/tests/interchain_accounts/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration()
t := s.T()
ctx := context.TODO()

relayer := s.GetRelayer()
testName := t.Name()
relayer := s.SetupDefaultPath(testName)

chainA, chainB := s.GetChains()
controllerAccount := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)

Expand All @@ -58,7 +60,7 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration()
})

t.Run("start relayer", func(t *testing.T) {
s.StartRelayer(relayer)
s.StartRelayer(relayer, testName)
})

s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA, chainB))
Expand Down
6 changes: 4 additions & 2 deletions e2e/tests/interchain_accounts/groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat
err error
)

relayer := s.GetRelayer()
testName := t.Name()
relayer := s.SetupDefaultPath(testName)

chainA, chainB := s.GetChains()

chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)
Expand Down Expand Up @@ -135,7 +137,7 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat
})

t.Run("start relayer", func(t *testing.T) {
s.StartRelayer(relayer)
s.StartRelayer(relayer, testName)
})

t.Run("verify interchain account registration success", func(t *testing.T) {
Expand Down
Loading
Loading