Skip to content

Commit

Permalink
Close IBC channels that are opened in integration-tests (#640)
Browse files Browse the repository at this point in the history
This PR, fixes the failing tests that were failing after the upgrade.
Apparently, we must close the channel that we create in integration
tests, so the outside relayer is not confused.
  • Loading branch information
miladz68 authored Sep 7, 2023
1 parent 05d98fc commit 6cabec4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions integration-tests/chain_ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func CreateIBCChannelsAndConnect(
dstChainPort string,
channelVersion string,
channelOrder ibcchanneltypes.Order,
) {
) func() {
t.Helper()

log := zaptest.NewLogger(t)
Expand All @@ -296,6 +296,7 @@ func CreateIBCChannelsAndConnect(
t.Fatalf("Unsupported chennel order type:%d", channelOrder)
}

pathName := fmt.Sprintf("%s-%s", srcChain.ChainSettings.ChainID, dstChain.ChainSettings.ChainID)
require.NoError(t, relayerSrcChain.CreateOpenChannels(
ctx,
relayerDstChain,
Expand All @@ -305,9 +306,12 @@ func CreateIBCChannelsAndConnect(
channelOrderString, channelVersion,
false,
"",
// FIXME(v47-ibc) validate that the config is valid
fmt.Sprintf("%s-%s", srcChain.ChainSettings.ChainID, dstChain.ChainSettings.ChainID),
pathName,
))
closerFunc := func() {
require.NoError(t, relayerSrcChain.CloseChannel(ctx, relayerDstChain, 5, 5*time.Second, srcChain.ChainSettings.ChainID, srcChainPort, "", pathName))
}
return closerFunc
}

func setupRelayerChain(
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/ibc/wasm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func TestIBCCallFromSmartContract(t *testing.T) {
requireT.NotEmpty(osmosisIBCPort)
t.Logf("Osmisis contrac IBC port:%s", osmosisIBCPort)

integrationtests.CreateIBCChannelsAndConnect(
closerFunc := integrationtests.CreateIBCChannelsAndConnect(
ctx,
t,
coreumChain.Chain,
Expand All @@ -244,6 +244,7 @@ func TestIBCCallFromSmartContract(t *testing.T) {
channelIBCVersion,
ibcchanneltypes.UNORDERED,
)
defer closerFunc()

coreumToOsmosisChannelID := coreumChain.AwaitForIBCChannelID(ctx, t, coreumIBCPort, osmosisChain.ChainSettings.ChainID)
osmosisToCoreumChannelID := osmosisChain.AwaitForIBCChannelID(ctx, t, osmosisIBCPort, coreumChain.ChainSettings.ChainID)
Expand Down

0 comments on commit 6cabec4

Please sign in to comment.