Compare commits
2 Commits
229eb30354
...
864703d77c
Author | SHA1 | Date | |
---|---|---|---|
864703d77c | |||
a6023966e4 |
@ -16,7 +16,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"git.vdb.to/cerc-io/laconic2d/tests/e2e"
|
||||
types "git.vdb.to/cerc-io/laconic2d/x/auction"
|
||||
"git.vdb.to/cerc-io/laconic2d/x/auction/client/cli"
|
||||
)
|
||||
@ -48,9 +47,7 @@ func (ets *E2ETestSuite) SetupSuite() { //nolint: all
|
||||
var err error
|
||||
|
||||
ets.network, err = network.New(ets.T(), ets.T().TempDir(), ets.cfg)
|
||||
if err != nil {
|
||||
e2e.HandleNetworkSetupError(&ets.Suite, ets.network, err)
|
||||
}
|
||||
sr.NoError(err)
|
||||
|
||||
_, err = ets.network.WaitForHeight(1)
|
||||
sr.NoError(err)
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"git.vdb.to/cerc-io/laconic2d/tests/e2e"
|
||||
bondtypes "git.vdb.to/cerc-io/laconic2d/x/bond"
|
||||
"git.vdb.to/cerc-io/laconic2d/x/bond/client/cli"
|
||||
)
|
||||
@ -40,9 +39,7 @@ func (ets *E2ETestSuite) SetupSuite() { //nolint: all
|
||||
var err error
|
||||
|
||||
ets.network, err = network.New(ets.T(), ets.T().TempDir(), ets.cfg)
|
||||
if err != nil {
|
||||
e2e.HandleNetworkSetupError(&ets.Suite, ets.network, err)
|
||||
}
|
||||
sr.NoError(err)
|
||||
|
||||
_, err = ets.network.WaitForHeight(1)
|
||||
sr.NoError(err)
|
||||
|
@ -3,9 +3,6 @@ package e2e
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
pruningtypes "cosmossdk.io/store/pruning/types"
|
||||
@ -19,7 +16,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/staking"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
laconicApp "git.vdb.to/cerc-io/laconic2d/app"
|
||||
auctionmodule "git.vdb.to/cerc-io/laconic2d/x/auction/module"
|
||||
@ -69,40 +65,3 @@ func NewTestNetworkFixture() network.TestFixture {
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func HandleNetworkSetupError(s *suite.Suite, n *network.Network, err error) {
|
||||
// Allow time extension for a block
|
||||
// (avoids failure in CI)
|
||||
if strings.Contains(err.Error(), "timeout exceeded waiting for block") {
|
||||
// Ensure we cleanup incase any test was abruptly halted (e.g. SIGINT)
|
||||
trapSignal(n.Cleanup)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
// trapSignal traps SIGINT and SIGTERM and calls os.Exit once a signal is received.
|
||||
func trapSignal(cleanupFunc func()) {
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
go func() {
|
||||
sig := <-sigs
|
||||
|
||||
if cleanupFunc != nil {
|
||||
cleanupFunc()
|
||||
}
|
||||
exitCode := 128
|
||||
|
||||
switch sig {
|
||||
case syscall.SIGINT:
|
||||
exitCode += int(syscall.SIGINT)
|
||||
case syscall.SIGTERM:
|
||||
exitCode += int(syscall.SIGTERM)
|
||||
}
|
||||
|
||||
os.Exit(exitCode)
|
||||
}()
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"git.vdb.to/cerc-io/laconic2d/tests/e2e"
|
||||
bondtypes "git.vdb.to/cerc-io/laconic2d/x/bond"
|
||||
bondcli "git.vdb.to/cerc-io/laconic2d/x/bond/client/cli"
|
||||
registrytypes "git.vdb.to/cerc-io/laconic2d/x/registry"
|
||||
@ -57,9 +56,7 @@ func (ets *E2ETestSuite) SetupSuite() {
|
||||
ets.cfg.GenesisState = genesisState
|
||||
|
||||
ets.network, err = network.New(ets.T(), ets.T().TempDir(), ets.cfg)
|
||||
if err != nil {
|
||||
e2e.HandleNetworkSetupError(&ets.Suite, ets.network, err)
|
||||
}
|
||||
sr.NoError(err)
|
||||
|
||||
_, err = ets.network.WaitForHeight(2)
|
||||
sr.NoError(err)
|
||||
|
@ -26,10 +26,10 @@ func ModuleAccountInvariant(k *Keeper) sdk.Invariant {
|
||||
moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName)
|
||||
if k.bankKeeper.GetAllBalances(ctx, moduleAddress).IsAnyNegative() {
|
||||
return sdk.FormatInvariant(
|
||||
types.ModuleName,
|
||||
"module-account",
|
||||
fmt.Sprintf("Module account '%s' has negative balance.", types.ModuleName)),
|
||||
true
|
||||
types.ModuleName,
|
||||
"module-account",
|
||||
fmt.Sprintf("Module account '%s' has negative balance.", types.ModuleName),
|
||||
), true
|
||||
}
|
||||
|
||||
return "", false
|
||||
|
@ -285,7 +285,6 @@ func (k Keeper) QueryAuctionsByBidder(ctx sdk.Context, bidderAddress string) ([]
|
||||
|
||||
// CreateAuction creates a new auction.
|
||||
func (k Keeper) CreateAuction(ctx sdk.Context, msg auctiontypes.MsgCreateAuction) (*auctiontypes.Auction, error) {
|
||||
// TODO: Setup checks
|
||||
// Might be called from another module directly, always validate.
|
||||
err := msg.ValidateBasic()
|
||||
if err != nil {
|
||||
|
@ -26,10 +26,10 @@ func ModuleAccountInvariant(k *Keeper) sdk.Invariant {
|
||||
moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName)
|
||||
if k.bankKeeper.GetAllBalances(ctx, moduleAddress).IsAnyNegative() {
|
||||
return sdk.FormatInvariant(
|
||||
types.ModuleName,
|
||||
"module-account",
|
||||
fmt.Sprintf("Module account '%s' has negative balance.", types.ModuleName)),
|
||||
true
|
||||
types.ModuleName,
|
||||
"module-account",
|
||||
fmt.Sprintf("Module account '%s' has negative balance.", types.ModuleName),
|
||||
), true
|
||||
}
|
||||
|
||||
return "", false
|
||||
|
@ -33,10 +33,10 @@ func ModuleAccountInvariant(k *Keeper) sdk.Invariant {
|
||||
moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName)
|
||||
if k.bankKeeper.GetAllBalances(ctx, moduleAddress).IsAnyNegative() {
|
||||
return sdk.FormatInvariant(
|
||||
types.ModuleName,
|
||||
"module-account",
|
||||
fmt.Sprintf("Module account '%s' has negative balance.", types.ModuleName)),
|
||||
true
|
||||
types.ModuleName,
|
||||
"module-account",
|
||||
fmt.Sprintf("Module account '%s' has negative balance.", types.ModuleName),
|
||||
), true
|
||||
}
|
||||
|
||||
return "", false
|
||||
@ -63,7 +63,11 @@ func RecordBondInvariant(k *Keeper) sdk.Invariant {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return sdk.FormatInvariant(types.ModuleName, "record-bond", fmt.Sprintf("Bond not found for record id: '%s'.", err.Error())), true
|
||||
return sdk.FormatInvariant(
|
||||
types.ModuleName,
|
||||
"record-bond",
|
||||
fmt.Sprintf("Bond not found for record id: '%s'.", err.Error()),
|
||||
), true
|
||||
}
|
||||
|
||||
return "", false
|
||||
|
Loading…
Reference in New Issue
Block a user