mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-27 07:48:29 +00:00
renamed a bunch of things to please the linters
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
e1d8c1925f
commit
1818460851
@ -1,4 +1,4 @@
|
||||
package gasConsumption
|
||||
package gas
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@ -9,9 +9,9 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
func TestGasConsumptionE2EDaoTestSuite(t *testing.T) {
|
||||
func TestConsumptionE2EDaoTestSuite(t *testing.T) {
|
||||
time.Sleep(2 * time.Second)
|
||||
cfg := network.LoaderDefaultConfig()
|
||||
cfg.NumValidators = 3
|
||||
suite.Run(t, NewGasConsumptionE2ETestSuite(cfg))
|
||||
suite.Run(t, NewConsumptionE2ETestSuite(cfg))
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package gasConsumption
|
||||
package gas
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
@ -21,7 +21,7 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type GasConsumptionE2ETestSuite struct {
|
||||
type ConsumptionE2ETestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
cfg network.Config
|
||||
@ -30,11 +30,11 @@ type GasConsumptionE2ETestSuite struct {
|
||||
feeDenom string
|
||||
}
|
||||
|
||||
func NewGasConsumptionE2ETestSuite(cfg network.Config) *GasConsumptionE2ETestSuite {
|
||||
return &GasConsumptionE2ETestSuite{cfg: cfg}
|
||||
func NewConsumptionE2ETestSuite(cfg network.Config) *ConsumptionE2ETestSuite {
|
||||
return &ConsumptionE2ETestSuite{cfg: cfg}
|
||||
}
|
||||
|
||||
func (s *GasConsumptionE2ETestSuite) createValAccount(cfg network.Config) (address sdk.AccAddress, err error) {
|
||||
func (s *ConsumptionE2ETestSuite) createValAccount(cfg network.Config) (address sdk.AccAddress, err error) {
|
||||
buf := bufio.NewReader(os.Stdin)
|
||||
|
||||
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, s.T().TempDir(), buf, cfg.Codec, cfg.KeyringOptions...)
|
||||
@ -63,7 +63,7 @@ func (s *GasConsumptionE2ETestSuite) createValAccount(cfg network.Config) (addre
|
||||
return addr, nil
|
||||
}
|
||||
|
||||
func (s *GasConsumptionE2ETestSuite) SetupSuite() {
|
||||
func (s *ConsumptionE2ETestSuite) SetupSuite() {
|
||||
s.T().Log("setting up e2e dao gas consumption test suite")
|
||||
|
||||
s.feeDenom = sample.FeeDenom
|
||||
@ -93,12 +93,12 @@ func (s *GasConsumptionE2ETestSuite) SetupSuite() {
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *GasConsumptionE2ETestSuite) TearDownSuite() {
|
||||
func (s *ConsumptionE2ETestSuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e dao gas consumption test suites")
|
||||
}
|
||||
|
||||
func (s *GasConsumptionE2ETestSuite) TestValidatorConsumption() {
|
||||
func (s *ConsumptionE2ETestSuite) TestValidatorConsumption() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
k, err := val.ClientCtx.Keyring.Key(sample.Name)
|
||||
@ -117,7 +117,7 @@ func (s *GasConsumptionE2ETestSuite) TestValidatorConsumption() {
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *GasConsumptionE2ETestSuite) TestNonValidatorConsumptionOverflow() {
|
||||
func (s *ConsumptionE2ETestSuite) TestNonValidatorConsumptionOverflow() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
k, err := val.ClientCtx.Keyring.Key(sample.Name)
|
||||
@ -141,7 +141,7 @@ func (s *GasConsumptionE2ETestSuite) TestNonValidatorConsumptionOverflow() {
|
||||
assert.Contains(s.T(), err.Error(), "out of gas")
|
||||
}
|
||||
|
||||
func (s *GasConsumptionE2ETestSuite) createMsgs(from sdk.AccAddress, to sdk.AccAddress, n int) (msgs []sdk.Msg) {
|
||||
func (s *ConsumptionE2ETestSuite) createMsgs(from sdk.AccAddress, to sdk.AccAddress, n int) (msgs []sdk.Msg) {
|
||||
coins := sdk.NewCoins(sdk.NewInt64Coin(s.feeDenom, 10))
|
||||
for i := 0; i < n; i++ {
|
||||
msg := banktypes.NewMsgSend(from, to, coins)
|
||||
@ -150,7 +150,7 @@ func (s *GasConsumptionE2ETestSuite) createMsgs(from sdk.AccAddress, to sdk.AccA
|
||||
return
|
||||
}
|
||||
|
||||
func (s *GasConsumptionE2ETestSuite) TestNetworkBasedTxGasLimit() {
|
||||
func (s *ConsumptionE2ETestSuite) TestNetworkBasedTxGasLimit() {
|
||||
var gasAmountAboveGlobalGasLimit uint64 = 200000000
|
||||
libConfig := lib.GetConfig()
|
||||
libConfig.SetTxGas(gasAmountAboveGlobalGasLimit)
|
||||
@ -1,4 +1,4 @@
|
||||
package restrictedMsgs
|
||||
package msgs
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@ -1,4 +1,4 @@
|
||||
package restrictedMsgs
|
||||
package msgs
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -13,5 +13,5 @@ func TestPopE2EDaoTestSuite(t *testing.T) {
|
||||
time.Sleep(2 * time.Second)
|
||||
cfg := network.LoaderDefaultConfig()
|
||||
cfg.NumValidators = 3
|
||||
suite.Run(t, NewPopSelectionE2ETestSuite(cfg))
|
||||
suite.Run(t, NewSelectionE2ETestSuite(cfg))
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ var machines = []struct {
|
||||
},
|
||||
}
|
||||
|
||||
type PopSelectionE2ETestSuite struct {
|
||||
type SelectionE2ETestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
cfg network.Config
|
||||
@ -55,13 +55,13 @@ type PopSelectionE2ETestSuite struct {
|
||||
errormsg string
|
||||
}
|
||||
|
||||
func NewPopSelectionE2ETestSuite(cfg network.Config) *PopSelectionE2ETestSuite {
|
||||
testsuite := &PopSelectionE2ETestSuite{cfg: cfg}
|
||||
func NewSelectionE2ETestSuite(cfg network.Config) *SelectionE2ETestSuite {
|
||||
testsuite := &SelectionE2ETestSuite{cfg: cfg}
|
||||
testsuite.errormsg = "--%s=%s"
|
||||
return testsuite
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) SetupSuite() {
|
||||
func (s *SelectionE2ETestSuite) SetupSuite() {
|
||||
s.T().Log("setting up e2e dao pop selection test suite")
|
||||
|
||||
s.popEpochs = 10
|
||||
@ -86,12 +86,12 @@ func (s *PopSelectionE2ETestSuite) SetupSuite() {
|
||||
}
|
||||
|
||||
// TearDownSuite clean up after testing
|
||||
func (s *PopSelectionE2ETestSuite) TearDownSuite() {
|
||||
func (s *SelectionE2ETestSuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e dao pop selection test suite")
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) perpareLocalTest() testutil.BufferWriter {
|
||||
func (s *SelectionE2ETestSuite) perpareLocalTest() testutil.BufferWriter {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
latestHeight, err := s.network.LatestHeight()
|
||||
@ -123,7 +123,7 @@ type yamlChallenge struct {
|
||||
Finished bool `yaml:"finished"`
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) sendPoPResult(storedChallenge []byte, success bool) {
|
||||
func (s *SelectionE2ETestSuite) sendPoPResult(storedChallenge []byte, success bool) {
|
||||
val := s.network.Validators[0]
|
||||
var wrapper struct {
|
||||
Challenge yamlChallenge `yaml:"challenge"`
|
||||
@ -156,14 +156,14 @@ func (s *PopSelectionE2ETestSuite) sendPoPResult(storedChallenge []byte, success
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) TestPopSelectionNoActors() {
|
||||
func (s *SelectionE2ETestSuite) TestPopSelectionNoActors() {
|
||||
out := s.perpareLocalTest()
|
||||
|
||||
assert.NotContains(s.T(), out.String(), machines[0].address)
|
||||
assert.NotContains(s.T(), out.String(), machines[1].address)
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) TestPopSelectionOneActors() {
|
||||
func (s *SelectionE2ETestSuite) TestPopSelectionOneActors() {
|
||||
err := e2etestutil.AttestMachine(s.network, machines[0].name, machines[0].mnemonic, 0, s.feeDenom)
|
||||
s.Require().NoError(err)
|
||||
|
||||
@ -173,7 +173,7 @@ func (s *PopSelectionE2ETestSuite) TestPopSelectionOneActors() {
|
||||
assert.NotContains(s.T(), out.String(), machines[1].address)
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) TestPopSelectionTwoActors() {
|
||||
func (s *SelectionE2ETestSuite) TestPopSelectionTwoActors() {
|
||||
err := e2etestutil.AttestMachine(s.network, machines[1].name, machines[1].mnemonic, 1, s.feeDenom)
|
||||
s.Require().NoError(err)
|
||||
|
||||
@ -184,7 +184,7 @@ func (s *PopSelectionE2ETestSuite) TestPopSelectionTwoActors() {
|
||||
s.sendPoPResult(out.Bytes(), true)
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) VerifyTokens(token string) {
|
||||
func (s *SelectionE2ETestSuite) VerifyTokens(token string) {
|
||||
val := s.network.Validators[0]
|
||||
// check balance for crddl
|
||||
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetCmdQueryTotalSupply(), []string{
|
||||
@ -211,7 +211,7 @@ func (s *PopSelectionE2ETestSuite) VerifyTokens(token string) {
|
||||
assert.Equal(s.T(), "amount: \"11986301368\"\ndenom: "+token+"\n", out.String()) // 2 * 5993150684 = 11986301368
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) TestTokenDistribution1() {
|
||||
func (s *SelectionE2ETestSuite) TestTokenDistribution1() {
|
||||
out := s.perpareLocalTest()
|
||||
|
||||
assert.Contains(s.T(), out.String(), machines[0].address)
|
||||
@ -252,7 +252,7 @@ func (s *PopSelectionE2ETestSuite) TestTokenDistribution1() {
|
||||
s.VerifyTokens(daoGenState.Params.ClaimDenom)
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) TestTokenRedeemClaim() {
|
||||
func (s *SelectionE2ETestSuite) TestTokenRedeemClaim() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
k, err := val.ClientCtx.Keyring.Key(machines[0].name)
|
||||
@ -311,7 +311,7 @@ func (s *PopSelectionE2ETestSuite) TestTokenRedeemClaim() {
|
||||
assert.Equal(s.T(), "redeemClaim:\n amount: \"10000\"\n beneficiary: liquidAddress\n confirmed: true\n creator: plmnt1kp93kns6hs2066d8qw0uz84fw3vlthewt2ck6p\n id: \"0\"\n liquidTxHash: \"0000000000000000000000000000000000000000000000000000000000000000\"\n", qOut.String())
|
||||
}
|
||||
|
||||
func (s *PopSelectionE2ETestSuite) createValAccount(cfg network.Config) (address sdk.AccAddress, err error) {
|
||||
func (s *SelectionE2ETestSuite) createValAccount(cfg network.Config) (address sdk.AccAddress, err error) {
|
||||
buf := bufio.NewReader(os.Stdin)
|
||||
|
||||
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, s.T().TempDir(), buf, cfg.Codec, cfg.KeyringOptions...)
|
||||
Loading…
x
Reference in New Issue
Block a user