@@ -26,6 +26,7 @@ import (
2626 "github.com/ignite/cli/v29/ignite/pkg/cmdrunner/step"
2727 "github.com/ignite/cli/v29/ignite/pkg/errors"
2828 "github.com/ignite/cli/v29/ignite/pkg/goanalysis"
29+ "github.com/ignite/cli/v29/ignite/pkg/randstr"
2930 "github.com/ignite/cli/v29/ignite/pkg/xyaml"
3031 envtest "github.com/ignite/cli/v29/integration"
3132)
@@ -35,8 +36,8 @@ const (
3536)
3637
3738var (
38- bobName = "bob"
39- marsConfig = v1.Config {
39+ bobName = "bob"
40+ refChainConfig = v1.Config {
4041 Config : base.Config {
4142 Version : 1 ,
4243 Accounts : []base.Account {
6162 Coins : []string {"500token" , "100000000stake" },
6263 Host : ":4501" ,
6364 },
64- Genesis : xyaml.Map {"chain_id" : "mars-1" },
65+ Genesis : xyaml.Map {"chain_id" : randstr . Runes ( 12 ) },
6566 },
6667 Validators : []v1.Validator {
6768 {
@@ -77,11 +78,11 @@ var (
7778 "p2p" : xyaml.Map {"laddr" : ":26658" },
7879 "rpc" : xyaml.Map {"laddr" : ":26658" , "pprof_laddr" : ":6061" },
7980 },
80- Home : "$HOME/.mars" ,
81+ Home : filepath . Join ( os . TempDir (), randstr . Runes ( 5 )) ,
8182 },
8283 },
8384 }
84- earthConfig = v1.Config {
85+ hostChainConfig = v1.Config {
8586 Config : base.Config {
8687 Version : 1 ,
8788 Accounts : []base.Account {
@@ -106,7 +107,7 @@ var (
106107 Coins : []string {"500token" , "100000000stake" },
107108 Host : ":4500" ,
108109 },
109- Genesis : xyaml.Map {"chain_id" : "earth-1" },
110+ Genesis : xyaml.Map {"chain_id" : randstr . Runes ( 12 ) },
110111 },
111112 Validators : []v1.Validator {
112113 {
@@ -122,7 +123,7 @@ var (
122123 "p2p" : xyaml.Map {"laddr" : ":26656" },
123124 "rpc" : xyaml.Map {"laddr" : ":26656" , "pprof_laddr" : ":6060" },
124125 },
125- Home : "$HOME/.earth" ,
126+ Home : filepath . Join ( os . TempDir (), randstr . Runes ( 5 )) ,
126127 },
127128 },
128129 }
@@ -384,12 +385,12 @@ func TestBlogIBC(t *testing.T) {
384385 availableport .WithMaxPort (5000 ),
385386 )
386387 require .NoError (t , err )
387- earthAPI , earthRPC , earthGRPC , earthFaucet := runChain (ctx , t , env , app , earthConfig , tmpDir , ports [:7 ])
388- earthChainID := earthConfig .Genesis ["chain_id" ].(string )
389- earthHome := earthConfig .Validators [0 ].Home
390- marsAPI , marsRPC , marsGRPC , marsFaucet := runChain (ctx , t , env , app , marsConfig , tmpDir , ports [7 :])
391- marsChainID := marsConfig .Genesis ["chain_id" ].(string )
392- marsHome := marsConfig .Validators [0 ].Home
388+ hostChainAPI , hostChainRPC , hostChainGRPC , hostChainFaucet := runChain (ctx , t , env , app , hostChainConfig , tmpDir , ports [:7 ])
389+ hostChainChainID := hostChainConfig .Genesis ["chain_id" ].(string )
390+ hostChainHome := hostChainConfig .Validators [0 ].Home
391+ refChainAPI , refChainRPC , refChainGRPC , refChainFaucet := runChain (ctx , t , env , app , refChainConfig , tmpDir , ports [7 :])
392+ refChainChainID := refChainConfig .Genesis ["chain_id" ].(string )
393+ refChainHome := refChainConfig .Validators [0 ].Home
393394
394395 // check the chains is up
395396 stepsCheckChains := step .NewSteps (
@@ -400,10 +401,10 @@ func TestBlogIBC(t *testing.T) {
400401 "output" , "json" ,
401402 ),
402403 step .PreExec (func () error {
403- if err := env .IsAppServed (ctx , earthAPI ); err != nil {
404+ if err := env .IsAppServed (ctx , hostChainAPI ); err != nil {
404405 return err
405406 }
406- return env .IsAppServed (ctx , marsAPI )
407+ return env .IsAppServed (ctx , refChainAPI )
407408 }),
408409 ),
409410 )
@@ -417,7 +418,7 @@ func TestBlogIBC(t *testing.T) {
417418 "install" ,
418419 "-g" ,
419420 // filepath.Join(goenv.GoPath(), "src/github.com/ignite/apps/hermes"), // Local path for test proposals
420- "github.com/ignite/apps/hermes@hermes/v0.2.2 " ,
421+ "github.com/ignite/apps/hermes@hermes/v0.2.8 " ,
421422 ),
422423 )),
423424 ))
@@ -428,14 +429,14 @@ func TestBlogIBC(t *testing.T) {
428429 "relayer" ,
429430 "hermes" ,
430431 "configure" ,
431- earthChainID ,
432- earthRPC ,
433- earthGRPC ,
434- marsChainID ,
435- marsRPC ,
436- marsGRPC ,
437- "--chain-a-faucet" , earthFaucet ,
438- "--chain-b-faucet" , marsFaucet ,
432+ hostChainChainID ,
433+ hostChainRPC ,
434+ hostChainGRPC ,
435+ refChainChainID ,
436+ refChainRPC ,
437+ refChainGRPC ,
438+ "--chain-a-faucet" , hostChainFaucet ,
439+ "--chain-b-faucet" , refChainFaucet ,
439440 "--generate-wallets" ,
440441 "--overwrite-config" ,
441442 ),
@@ -445,7 +446,13 @@ func TestBlogIBC(t *testing.T) {
445446 go func () {
446447 env .Must (env .Exec ("run the hermes relayer" ,
447448 step .NewSteps (step .New (
448- step .Exec (envtest .IgniteApp , "relayer" , "hermes" , "start" , earthChainID , marsChainID ),
449+ step .Exec (envtest .IgniteApp , "relayer" , "hermes" , "start" , hostChainChainID , refChainChainID ),
450+ step .PostExec (func (execErr error ) error {
451+ if execErr != nil {
452+ return execErr
453+ }
454+ return nil
455+ }),
449456 )),
450457 envtest .ExecCtx (ctx ),
451458 ))
@@ -465,7 +472,7 @@ func TestBlogIBC(t *testing.T) {
465472 "ibc" ,
466473 "channel" ,
467474 "channels" ,
468- "--node" , earthRPC ,
475+ "--node" , hostChainRPC ,
469476 "--log_format" , "json" ,
470477 "--output" , "json" ,
471478 ),
@@ -493,7 +500,7 @@ func TestBlogIBC(t *testing.T) {
493500 receiverAddr = "cosmos1nrksk5swk6lnmlq670a8kwxmsjnu0ezqts39sa"
494501 txOutput = & bytes.Buffer {}
495502 txResponse struct {
496- Code int
503+ Code int `json:"code"`
497504 RawLog string `json:"raw_log"`
498505 TxHash string `json:"txhash"`
499506 }
@@ -512,9 +519,9 @@ func TestBlogIBC(t *testing.T) {
512519 receiverAddr ,
513520 "100000stake" ,
514521 "--from" , sender ,
515- "--node" , earthRPC ,
516- "--home" , earthHome ,
517- "--chain-id" , earthChainID ,
522+ "--node" , hostChainRPC ,
523+ "--home" , hostChainHome ,
524+ "--chain-id" , hostChainChainID ,
518525 "--output" , "json" ,
519526 "--log_format" , "json" ,
520527 "--keyring-backend" , "test" ,
@@ -533,9 +540,9 @@ func TestBlogIBC(t *testing.T) {
533540 "q" ,
534541 "tx" ,
535542 txResponse .TxHash ,
536- "--node" , earthRPC ,
537- "--home" , earthHome ,
538- "--chain-id" , earthChainID ,
543+ "--node" , hostChainRPC ,
544+ "--home" , hostChainHome ,
545+ "--chain-id" , hostChainChainID ,
539546 "--output" , "json" ,
540547 "--log_format" , "json" ,
541548 ),
@@ -576,9 +583,9 @@ func TestBlogIBC(t *testing.T) {
576583 "bank" ,
577584 "balances" ,
578585 receiverAddr ,
579- "--node" , marsRPC ,
580- "--home" , marsHome ,
581- "--chain-id" , marsChainID ,
586+ "--node" , refChainRPC ,
587+ "--home" , refChainHome ,
588+ "--chain-id" , refChainChainID ,
582589 "--log_format" , "json" ,
583590 "--output" , "json" ,
584591 ),
@@ -604,9 +611,4 @@ func TestBlogIBC(t *testing.T) {
604611 ),
605612 )
606613 env .Must (env .Exec ("check ibc balance" , steps , envtest .ExecRetry ()))
607-
608- // TODO test ibc using the blog post methods:
609- // step.Exec(app.Binary(), "tx", "blog", "send-ibc-post", "transfer", "channel-0", "Hello", "Hello_Mars-Alice_from_Earth", "--chain-id", earthChainID, "--from", "alice", "--node", earthGRPC, "--output", "json", "--log_format", "json", "--yes")
610- // TODO test ibc using the hermes ft-transfer:
611- // step.Exec(envtest.IgniteApp, "hermes", "exec", "--", "--config", earthConfig, "tx", "ft-transfer", "--timeout-seconds", "1000", "--dst-chain", earthChainID, "--src-chain", marsChainID, "--src-port", "transfer", "--src-channel", "channel-0", "--amount", "100000", "--denom", "stake", "--output", "json", "--log_format", "json", "--yes")
612614}
0 commit comments