renamed a bunch of things to please the linters

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2024-03-08 11:50:38 +01:00
parent e1d8c1925f
commit 1818460851
No known key found for this signature in database
6 changed files with 31 additions and 31 deletions

View File

@ -1,4 +1,4 @@
package gasConsumption package gas
import ( import (
"testing" "testing"
@ -9,9 +9,9 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
) )
func TestGasConsumptionE2EDaoTestSuite(t *testing.T) { func TestConsumptionE2EDaoTestSuite(t *testing.T) {
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
cfg := network.LoaderDefaultConfig() cfg := network.LoaderDefaultConfig()
cfg.NumValidators = 3 cfg.NumValidators = 3
suite.Run(t, NewGasConsumptionE2ETestSuite(cfg)) suite.Run(t, NewConsumptionE2ETestSuite(cfg))
} }

View File

@ -1,4 +1,4 @@
package gasConsumption package gas
import ( import (
"bufio" "bufio"
@ -21,7 +21,7 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
) )
type GasConsumptionE2ETestSuite struct { type ConsumptionE2ETestSuite struct {
suite.Suite suite.Suite
cfg network.Config cfg network.Config
@ -30,11 +30,11 @@ type GasConsumptionE2ETestSuite struct {
feeDenom string feeDenom string
} }
func NewGasConsumptionE2ETestSuite(cfg network.Config) *GasConsumptionE2ETestSuite { func NewConsumptionE2ETestSuite(cfg network.Config) *ConsumptionE2ETestSuite {
return &GasConsumptionE2ETestSuite{cfg: cfg} 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) buf := bufio.NewReader(os.Stdin)
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, s.T().TempDir(), buf, cfg.Codec, cfg.KeyringOptions...) 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 return addr, nil
} }
func (s *GasConsumptionE2ETestSuite) SetupSuite() { func (s *ConsumptionE2ETestSuite) SetupSuite() {
s.T().Log("setting up e2e dao gas consumption test suite") s.T().Log("setting up e2e dao gas consumption test suite")
s.feeDenom = sample.FeeDenom s.feeDenom = sample.FeeDenom
@ -93,12 +93,12 @@ func (s *GasConsumptionE2ETestSuite) SetupSuite() {
s.Require().NoError(err) s.Require().NoError(err)
} }
func (s *GasConsumptionE2ETestSuite) TearDownSuite() { func (s *ConsumptionE2ETestSuite) TearDownSuite() {
util.TerminationWaitGroup.Wait() util.TerminationWaitGroup.Wait()
s.T().Log("tearing down e2e dao gas consumption test suites") s.T().Log("tearing down e2e dao gas consumption test suites")
} }
func (s *GasConsumptionE2ETestSuite) TestValidatorConsumption() { func (s *ConsumptionE2ETestSuite) TestValidatorConsumption() {
val := s.network.Validators[0] val := s.network.Validators[0]
k, err := val.ClientCtx.Keyring.Key(sample.Name) k, err := val.ClientCtx.Keyring.Key(sample.Name)
@ -117,7 +117,7 @@ func (s *GasConsumptionE2ETestSuite) TestValidatorConsumption() {
s.Require().NoError(err) s.Require().NoError(err)
} }
func (s *GasConsumptionE2ETestSuite) TestNonValidatorConsumptionOverflow() { func (s *ConsumptionE2ETestSuite) TestNonValidatorConsumptionOverflow() {
val := s.network.Validators[0] val := s.network.Validators[0]
k, err := val.ClientCtx.Keyring.Key(sample.Name) 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") 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)) coins := sdk.NewCoins(sdk.NewInt64Coin(s.feeDenom, 10))
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
msg := banktypes.NewMsgSend(from, to, coins) msg := banktypes.NewMsgSend(from, to, coins)
@ -150,7 +150,7 @@ func (s *GasConsumptionE2ETestSuite) createMsgs(from sdk.AccAddress, to sdk.AccA
return return
} }
func (s *GasConsumptionE2ETestSuite) TestNetworkBasedTxGasLimit() { func (s *ConsumptionE2ETestSuite) TestNetworkBasedTxGasLimit() {
var gasAmountAboveGlobalGasLimit uint64 = 200000000 var gasAmountAboveGlobalGasLimit uint64 = 200000000
libConfig := lib.GetConfig() libConfig := lib.GetConfig()
libConfig.SetTxGas(gasAmountAboveGlobalGasLimit) libConfig.SetTxGas(gasAmountAboveGlobalGasLimit)

View File

@ -1,4 +1,4 @@
package restrictedMsgs package msgs
import ( import (
"testing" "testing"

View File

@ -1,4 +1,4 @@
package restrictedMsgs package msgs
import ( import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"

View File

@ -13,5 +13,5 @@ func TestPopE2EDaoTestSuite(t *testing.T) {
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
cfg := network.LoaderDefaultConfig() cfg := network.LoaderDefaultConfig()
cfg.NumValidators = 3 cfg.NumValidators = 3
suite.Run(t, NewPopSelectionE2ETestSuite(cfg)) suite.Run(t, NewSelectionE2ETestSuite(cfg))
} }

View File

@ -42,7 +42,7 @@ var machines = []struct {
}, },
} }
type PopSelectionE2ETestSuite struct { type SelectionE2ETestSuite struct {
suite.Suite suite.Suite
cfg network.Config cfg network.Config
@ -55,13 +55,13 @@ type PopSelectionE2ETestSuite struct {
errormsg string errormsg string
} }
func NewPopSelectionE2ETestSuite(cfg network.Config) *PopSelectionE2ETestSuite { func NewSelectionE2ETestSuite(cfg network.Config) *SelectionE2ETestSuite {
testsuite := &PopSelectionE2ETestSuite{cfg: cfg} testsuite := &SelectionE2ETestSuite{cfg: cfg}
testsuite.errormsg = "--%s=%s" testsuite.errormsg = "--%s=%s"
return testsuite return testsuite
} }
func (s *PopSelectionE2ETestSuite) SetupSuite() { func (s *SelectionE2ETestSuite) SetupSuite() {
s.T().Log("setting up e2e dao pop selection test suite") s.T().Log("setting up e2e dao pop selection test suite")
s.popEpochs = 10 s.popEpochs = 10
@ -86,12 +86,12 @@ func (s *PopSelectionE2ETestSuite) SetupSuite() {
} }
// TearDownSuite clean up after testing // TearDownSuite clean up after testing
func (s *PopSelectionE2ETestSuite) TearDownSuite() { func (s *SelectionE2ETestSuite) TearDownSuite() {
util.TerminationWaitGroup.Wait() util.TerminationWaitGroup.Wait()
s.T().Log("tearing down e2e dao pop selection test suite") 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] val := s.network.Validators[0]
latestHeight, err := s.network.LatestHeight() latestHeight, err := s.network.LatestHeight()
@ -123,7 +123,7 @@ type yamlChallenge struct {
Finished bool `yaml:"finished"` 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] val := s.network.Validators[0]
var wrapper struct { var wrapper struct {
Challenge yamlChallenge `yaml:"challenge"` Challenge yamlChallenge `yaml:"challenge"`
@ -156,14 +156,14 @@ func (s *PopSelectionE2ETestSuite) sendPoPResult(storedChallenge []byte, success
s.Require().NoError(err) s.Require().NoError(err)
} }
func (s *PopSelectionE2ETestSuite) TestPopSelectionNoActors() { func (s *SelectionE2ETestSuite) TestPopSelectionNoActors() {
out := s.perpareLocalTest() out := s.perpareLocalTest()
assert.NotContains(s.T(), out.String(), machines[0].address) assert.NotContains(s.T(), out.String(), machines[0].address)
assert.NotContains(s.T(), out.String(), machines[1].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) err := e2etestutil.AttestMachine(s.network, machines[0].name, machines[0].mnemonic, 0, s.feeDenom)
s.Require().NoError(err) s.Require().NoError(err)
@ -173,7 +173,7 @@ func (s *PopSelectionE2ETestSuite) TestPopSelectionOneActors() {
assert.NotContains(s.T(), out.String(), machines[1].address) 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) err := e2etestutil.AttestMachine(s.network, machines[1].name, machines[1].mnemonic, 1, s.feeDenom)
s.Require().NoError(err) s.Require().NoError(err)
@ -184,7 +184,7 @@ func (s *PopSelectionE2ETestSuite) TestPopSelectionTwoActors() {
s.sendPoPResult(out.Bytes(), true) s.sendPoPResult(out.Bytes(), true)
} }
func (s *PopSelectionE2ETestSuite) VerifyTokens(token string) { func (s *SelectionE2ETestSuite) VerifyTokens(token string) {
val := s.network.Validators[0] val := s.network.Validators[0]
// check balance for crddl // check balance for crddl
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetCmdQueryTotalSupply(), []string{ 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 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() out := s.perpareLocalTest()
assert.Contains(s.T(), out.String(), machines[0].address) assert.Contains(s.T(), out.String(), machines[0].address)
@ -252,7 +252,7 @@ func (s *PopSelectionE2ETestSuite) TestTokenDistribution1() {
s.VerifyTokens(daoGenState.Params.ClaimDenom) s.VerifyTokens(daoGenState.Params.ClaimDenom)
} }
func (s *PopSelectionE2ETestSuite) TestTokenRedeemClaim() { func (s *SelectionE2ETestSuite) TestTokenRedeemClaim() {
val := s.network.Validators[0] val := s.network.Validators[0]
k, err := val.ClientCtx.Keyring.Key(machines[0].name) 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()) 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) buf := bufio.NewReader(os.Stdin)
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, s.T().TempDir(), buf, cfg.Codec, cfg.KeyringOptions...) kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, s.T().TempDir(), buf, cfg.Codec, cfg.KeyringOptions...)