Skip to content

Commit

Permalink
Gaia simulation needs internal field access
Browse files Browse the repository at this point in the history
  • Loading branch information
cwgoes committed Jul 17, 2018
1 parent af206bd commit eda7eb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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}"
Expand Down Expand Up @@ -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
Expand Down
17 changes: 11 additions & 6 deletions cmd/gaia/simulation/sim_test.go → cmd/gaia/app/sim_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package simulation
package app

import (
"os"
"testing"

"github.com/stretchr/testify/require"

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"
)
Expand All @@ -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)
}
Expand Down

0 comments on commit eda7eb4

Please sign in to comment.