Gaia simulation needs internal field access

This commit is contained in:
Christopher Goes 2018-07-17 23:06:30 +02:00
parent af206bd0ed
commit eda7eb48cd
2 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,6 @@
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_SIMTEST=$(shell go list ./... | grep -v '/vendor/' | grep '/simulation')
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/')
COMMIT_HASH := $(shell git rev-parse --short HEAD)
BUILD_TAGS = netgo ledger
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)
test_sim:
@go test $(PACKAGES_SIMTEST) -v
@ENABLE_GAIA_SIMULATION=1 go test ./cmd/gaia/app -run TestFullGaiaSimulation -v
test_cover:
@bash tests/test_cover.sh

View File

@ -1,6 +1,7 @@
package simulation
package app
import (
"os"
"testing"
"github.com/stretchr/testify/require"
@ -8,7 +9,6 @@ import (
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
gaia "github.com/cosmos/cosmos-sdk/cmd/gaia/app"
"github.com/cosmos/cosmos-sdk/x/mock/simulation"
stake "github.com/cosmos/cosmos-sdk/x/stake"
)
@ -17,24 +17,29 @@ const (
NumKeys = 10
NumBlocks = 1000
BlockSize = 1000
simulationEnv = "ENABLE_GAIA_SIMULATION"
)
func TestFullGaiaSimulation(t *testing.T) {
if os.Getenv(simulationEnv) == "" {
t.Skip("Skipping Gaia simulation")
}
// Setup Gaia application
logger := log.NewNopLogger()
db := dbm.NewMemDB()
app := gaia.NewGaiaApp(logger, db, nil)
app := NewGaiaApp(logger, db, nil)
require.Equal(t, "GaiaApp", app.Name())
// Default genesis state
genesis := gaia.GenesisState{
Accounts: []gaia.GenesisAccount{},
genesis := GenesisState{
Accounts: []GenesisAccount{},
StakeData: stake.DefaultGenesisState(),
}
// Marshal genesis
appState, err := gaia.MakeCodec().MarshalJSON(genesis)
appState, err := MakeCodec().MarshalJSON(genesis)
if err != nil {
panic(err)
}