Gaia simulation needs internal field access
This commit is contained in:
parent
af206bd0ed
commit
eda7eb48cd
6
Makefile
6
Makefile
|
@ -1,6 +1,6 @@
|
||||||
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
||||||
PACKAGES_NOCLITEST=$(shell go list ./... | grep -v '/vendor/' | grep -v '/simulation' | grep -v github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test)
|
PACKAGES_NOCLITEST=$(shell go list ./... | grep -v '/vendor/' | grep -v github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test)
|
||||||
PACKAGES_SIMTEST=$(shell go list ./... | grep -v '/vendor/' | grep '/simulation')
|
PACKAGES_SIMTEST=$(shell go list ./... | grep -v '/vendor/')
|
||||||
COMMIT_HASH := $(shell git rev-parse --short HEAD)
|
COMMIT_HASH := $(shell git rev-parse --short HEAD)
|
||||||
BUILD_TAGS = netgo ledger
|
BUILD_TAGS = netgo ledger
|
||||||
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=${COMMIT_HASH}"
|
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=${COMMIT_HASH}"
|
||||||
|
@ -114,7 +114,7 @@ test_race:
|
||||||
@go test -race $(PACKAGES_NOCLITEST)
|
@go test -race $(PACKAGES_NOCLITEST)
|
||||||
|
|
||||||
test_sim:
|
test_sim:
|
||||||
@go test $(PACKAGES_SIMTEST) -v
|
@ENABLE_GAIA_SIMULATION=1 go test ./cmd/gaia/app -run TestFullGaiaSimulation -v
|
||||||
|
|
||||||
test_cover:
|
test_cover:
|
||||||
@bash tests/test_cover.sh
|
@bash tests/test_cover.sh
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package simulation
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -8,7 +9,6 @@ import (
|
||||||
dbm "github.com/tendermint/tendermint/libs/db"
|
dbm "github.com/tendermint/tendermint/libs/db"
|
||||||
"github.com/tendermint/tendermint/libs/log"
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
|
|
||||||
gaia "github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/mock/simulation"
|
"github.com/cosmos/cosmos-sdk/x/mock/simulation"
|
||||||
stake "github.com/cosmos/cosmos-sdk/x/stake"
|
stake "github.com/cosmos/cosmos-sdk/x/stake"
|
||||||
)
|
)
|
||||||
|
@ -17,24 +17,29 @@ const (
|
||||||
NumKeys = 10
|
NumKeys = 10
|
||||||
NumBlocks = 1000
|
NumBlocks = 1000
|
||||||
BlockSize = 1000
|
BlockSize = 1000
|
||||||
|
|
||||||
|
simulationEnv = "ENABLE_GAIA_SIMULATION"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFullGaiaSimulation(t *testing.T) {
|
func TestFullGaiaSimulation(t *testing.T) {
|
||||||
|
if os.Getenv(simulationEnv) == "" {
|
||||||
|
t.Skip("Skipping Gaia simulation")
|
||||||
|
}
|
||||||
|
|
||||||
// Setup Gaia application
|
// Setup Gaia application
|
||||||
logger := log.NewNopLogger()
|
logger := log.NewNopLogger()
|
||||||
db := dbm.NewMemDB()
|
db := dbm.NewMemDB()
|
||||||
app := gaia.NewGaiaApp(logger, db, nil)
|
app := NewGaiaApp(logger, db, nil)
|
||||||
require.Equal(t, "GaiaApp", app.Name())
|
require.Equal(t, "GaiaApp", app.Name())
|
||||||
|
|
||||||
// Default genesis state
|
// Default genesis state
|
||||||
genesis := gaia.GenesisState{
|
genesis := GenesisState{
|
||||||
Accounts: []gaia.GenesisAccount{},
|
Accounts: []GenesisAccount{},
|
||||||
StakeData: stake.DefaultGenesisState(),
|
StakeData: stake.DefaultGenesisState(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal genesis
|
// Marshal genesis
|
||||||
appState, err := gaia.MakeCodec().MarshalJSON(genesis)
|
appState, err := MakeCodec().MarshalJSON(genesis)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
Loading…
Reference in New Issue