Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/cosmos/cosm…
Browse files Browse the repository at this point in the history
…os-sdk-0.45.3
  • Loading branch information
alexanderbez committed Apr 12, 2022
2 parents a405674 + 53699e1 commit 63acd63
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ updates:
interval: daily
open-pull-requests-limit: 10
labels:
- automerge
- "A:automerge"
- dependencies
61 changes: 61 additions & 0 deletions tests/e2e/e2e_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"time"

"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/ory/dockertest/v3/docker"
Expand Down Expand Up @@ -63,6 +64,66 @@ func (s *IntegrationTestSuite) connectIBCChains() {
s.T().Logf("connected %s and %s chains via IBC", s.chainA.id, s.chainB.id)
}

func (s *IntegrationTestSuite) sendMsgSend(c *chain, valIdx int, from, to, amt, fees string) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

s.T().Logf("sending %s tokens from %s to %s on chain %s", amt, from, to, c.id)

exec, err := s.dkrPool.Client.CreateExec(docker.CreateExecOptions{
Context: ctx,
AttachStdout: true,
AttachStderr: true,
Container: s.valResources[c.id][valIdx].Container.ID,
User: "root",
Cmd: []string{
"gaiad",
"tx",
"bank",
"send",
from,
to,
amt,
fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id),
fmt.Sprintf("--%s=%s", flags.FlagFees, fees),
"--keyring-backend=test",
"--broadcast-mode=sync",
"--output=json",
"-y",
},
})
s.Require().NoError(err)

var (
outBuf bytes.Buffer
errBuf bytes.Buffer
)

err = s.dkrPool.Client.StartExec(exec.ID, docker.StartExecOptions{
Context: ctx,
Detach: false,
OutputStream: &outBuf,
ErrorStream: &errBuf,
})
s.Require().NoErrorf(err, "stdout: %s, stderr: %s", outBuf.String(), errBuf.String())

var txResp sdk.TxResponse
s.Require().NoError(cdc.UnmarshalJSON(outBuf.Bytes(), &txResp))

endpoint := fmt.Sprintf("http://%s", s.valResources[c.id][valIdx].GetHostPort("1317/tcp"))

// wait for the tx to be committed on chain
s.Require().Eventuallyf(
func() bool {
return queryGaiaTx(endpoint, txResp.TxHash) == nil
},
time.Minute,
5*time.Second,
"stdout: %s, stderr: %s",
outBuf.String(), errBuf.String(),
)
}

func (s *IntegrationTestSuite) sendIBC(srcChainID, dstChainID, recipient string, token sdk.Coin) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
Expand Down

0 comments on commit 63acd63

Please sign in to comment.