From 2919c37ed804b77b4aadf9f23d9db4d4053e4af2 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 12 Apr 2022 12:06:05 -0400 Subject: [PATCH 1/2] feat: add MsgSend E2E helper #1403 --- tests/e2e/e2e_util_test.go | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/e2e/e2e_util_test.go b/tests/e2e/e2e_util_test.go index ab6e8371e8c..52b0bdf82da 100644 --- a/tests/e2e/e2e_util_test.go +++ b/tests/e2e/e2e_util_test.go @@ -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" @@ -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() From 53699e16b64ecfb4f7b031f5215e00b10a353481 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 12 Apr 2022 12:09:16 -0400 Subject: [PATCH 2/2] Update dependabot.yml --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6416a23182c..fe436297e87 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,5 +18,5 @@ updates: interval: daily open-pull-requests-limit: 10 labels: - - automerge + - "A:automerge" - dependencies