Integrate Tendermint v0.35.0, including changes to build and test plumbing necessary to make everything build. This change does not update any SDK APIs to make use of new features. Co-authored-by: marbar3778 <marbar3778@yahoo.com> Co-authored-by: tycho garen <garen@tychoish.com> Co-authored-by: M. J. Fromberger <michael.j.fromberger@gmail.com> Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> Co-authored-by: Callum Waters <cmwaters19@gmail.com>
41 lines
946 B
Go
41 lines
946 B
Go
package mock
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
|
|
"github.com/rs/zerolog"
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
tmlog "github.com/tendermint/tendermint/libs/log"
|
|
|
|
"github.com/cosmos/cosmos-sdk/server"
|
|
)
|
|
|
|
// SetupApp returns an application as well as a clean-up function
|
|
// to be used to quickly setup a test case with an app
|
|
func SetupApp() (abci.Application, func(), error) {
|
|
var logger tmlog.Logger
|
|
|
|
logWriter := zerolog.ConsoleWriter{Out: os.Stderr}
|
|
logger = server.ZeroLogWrapper{
|
|
Logger: zerolog.New(logWriter).Level(zerolog.InfoLevel).With().Timestamp().Logger(),
|
|
}
|
|
logger = logger.With("module", "mock")
|
|
|
|
rootDir, err := ioutil.TempDir("", "mock-sdk")
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
cleanup := func() {
|
|
err := os.RemoveAll(rootDir)
|
|
if err != nil {
|
|
fmt.Printf("could not delete %s, had error %s\n", rootDir, err.Error())
|
|
}
|
|
}
|
|
|
|
app, err := NewApp(rootDir, logger)
|
|
return app, cleanup, err
|
|
}
|