Skip to content

Commit

Permalink
add more test cases to test-channel-upgrade
Browse files Browse the repository at this point in the history
Signed-off-by: Masanori Yoshida <[email protected]>
  • Loading branch information
siburu committed Aug 20, 2024
1 parent 6f607cb commit 4130557
Showing 1 changed file with 50 additions and 5 deletions.
55 changes: 50 additions & 5 deletions tests/cases/tm2tm/scripts/test-channel-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,67 @@ origDstOpts="--ordering $dstOrigOrder --connection-hops $dstOrigConnectionId --v
altSrcOpts="--ordering $srcAltOrder --connection-hops $srcAltConnectionId --version $srcAltVersion"
altDstOpts="--ordering $dstAltOrder --connection-hops $dstAltConnectionId --version $dstAltVersion"

# test channel upgrade (crossing-hello)
echo '##### case 1 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts
$RLY tx channel-upgrade init ibc01 ibc1 $altDstOpts
$RLY tx channel-upgrade execute ibc01
checkResult alt

# test channel upgrade (non-crossing-hello)
echo '##### case 2 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $origSrcOpts
$RLY tx channel-upgrade init ibc01 ibc0 $origSrcOpts
$RLY tx channel-upgrade init ibc01 ibc1 $origDstOpts
$RLY tx channel-upgrade execute ibc01
checkResult orig

# test channel upgrade cancel
echo '##### case 3 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts
$RLY tx channel-upgrade init ibc01 ibc1 $altDstOpts
$RLY tx channel-upgrade cancel ibc01 ibc0 # create situation where ibc0.error_receipt.sequence >= ibc1.channel.upgrade_sequence
$RLY tx channel-upgrade execute ibc01 # the channel upgrade of ibc1 should be cancelled
$RLY tx channel-upgrade cancel ibc01 ibc0 # ibc0 returns to UNINIT. ibc0.error_receipt.sequence >= ibc1.channel.upgrade_sequence
$RLY tx channel-upgrade execute ibc01 # ibc1's upgrade should be cancelled
checkResult orig

echo '##### case 4 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts
$RLY tx channel-upgrade execute ibc01 --target-src-state INIT --target-dst-state FLUSHING
$RLY tx channel-upgrade cancel ibc01 ibc0 # ibc0 returns to UNINIT. ibc1 is FLUSHING.
$RLY tx channel-upgrade execute ibc01 # ibc1's upgrade should be cancelled
checkResult orig

echo '##### case 5 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts
$RLY tx channel-upgrade execute ibc01 --target-src-state INIT --target-dst-state FLUSHING
$RLY tx channel-upgrade cancel ibc01 ibc0 # ibc0 returns to UNINIT. ibc1 is FLUSHING.
$RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts # ibc0 re-initiates new upgrade.
$RLY tx channel-upgrade execute ibc01 # The upgrade initiated by ibc0 should be completed after ibc1's one is cancelled.
checkResult alt

echo '##### case 6 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $origSrcOpts
$RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING
$RLY tx channel-upgrade cancel ibc01 ibc1 # ibc1 returns to UNINIT. ibc0 is FLUSHCOMPLETE.
$RLY tx channel-upgrade execute ibc01 # ibc0's upgrade (in FLUSHCOMPLETE) should be cancelled.
checkResult alt

echo '##### case 7 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $origSrcOpts
$RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING
$RLY tx channel-upgrade cancel ibc01 ibc1 # ibc1 returns to UNINIT. ibc0 is FLUSHCOMPLETE.
$RLY tx channel-upgrade init ibc01 ibc1 $origDstOpts # ibc1 re-initiates new upgrade.
$RLY tx channel-upgrade execute ibc01 # The upgrade initiated by ibc1 should be completed after ibc0's one is cancelled.
checkResult orig

# echo '##### case 8 #####'
# $RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts
# $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING
# sleep ???
# $RLY tx channel-upgrade execute
# checkResult orig

# echo '##### case 9 #####'
# $RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts
# $RLY tx channel-upgrade init ibc01 ibc1 $altDstOpts
# $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHING --target-dst-state FLUSHING
# sleep ???
# $RLY tx channel-upgrade execute
# checkResult orig

0 comments on commit 4130557

Please sign in to comment.