MCPcopy Create free account
hub / github.com/akash-network/node / SetupSuite

Method SetupSuite

testutil/network_suite.go:78–167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76}
77
78func (nts *NetworkTestSuite) SetupSuite() {
79 nts.kr = sdktestutil.NewTestKeyring(nts.cfg.Codec)
80 nts.network = network.New(nts.T(), nts.cfg)
81
82 _, err := nts.network.WaitForHeightWithTimeout(1, time.Second*30)
83 require.NoError(nts.T(), err)
84
85 walletCount := nts.countTests()
86 nts.T().Logf("setting up %d wallets for test", walletCount)
87 var msgs []sdk.Msg
88 //
89 for i := 0; i != walletCount; i++ {
90 name := fmt.Sprintf("wallet%d", i)
91 kinfo, str, err := nts.kr.NewMnemonic(name, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1)
92 require.NoError(nts.T(), err)
93 require.NotEmpty(nts.T(), str)
94
95 toAddr, err := kinfo.GetAddress()
96 require.NoError(nts.T(), err)
97
98 coins := sdk.NewCoins(sdk.NewCoin(nts.Config().BondDenom, sdkmath.NewInt(1000000)))
99 msg := banktypes.NewMsgSend(nts.Validator().Address, toAddr, coins)
100 msgs = append(msgs, msg)
101 }
102
103 ctx := context.Background()
104 cctx := nts.ClientContext().WithFrom(nts.network.Validators[0].Address.String())
105
106 cl, err := aclient.DiscoverClient(
107 ctx,
108 cctx,
109 cltypes.WithGas(cltypes.GasSetting{Simulate: true}),
110 cltypes.WithGasAdjustment(1.5),
111 cltypes.WithGasPrices("0.0025uakt"),
112 )
113 require.NoError(nts.T(), err)
114
115 _, err = cl.Tx().BroadcastMsgs(ctx, msgs, cclient.WithBroadcastMode("block"))
116 require.NoError(nts.T(), err)
117
118 // txf, err := tx.NewFactoryCLI(nts.ClientContext(), &pflag.FlagSet{})
119 // require.NoError(nts.T(), err)
120 //
121 // txf = txf.WithSignMode(signing.SignMode_SIGN_MODE_DIRECT)
122 // txf = txf.WithSimulateAndExecute(false)
123 //
124 // require.Equal(nts.T(), "node0", nts.ClientContext().GetFromName())
125 // keyInfo, err := txf.Keybase().Key(nts.ClientContext().GetFromName())
126 // require.NoError(nts.T(), err)
127 // require.NotNil(nts.T(), keyInfo)
128 //
129 // num, seq, err := txf.AccountRetriever().GetAccountNumberSequence(nts.ClientContext(), nts.Validator().Address)
130 // require.NoError(nts.T(), err)
131 // txf = txf.WithAccountNumber(num)
132 // txf = txf.WithSequence(seq)
133 // // txf = txf.WithGas(uint64(150000 * nts.countTests())) // Just made this up
134 // txf = txf.WithFees(fmt.Sprintf("%d%s", 100, nts.Config().BondDenom)) // Just made this up
135 //

Callers

nothing calls this directly

Calls 7

countTestsMethod · 0.95
ConfigMethod · 0.95
ValidatorMethod · 0.95
ClientContextMethod · 0.95
NewFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected