MCPcopy Create free account
hub / github.com/akash-network/node / TestFullAppSimulation

Function TestFullAppSimulation

app/sim_test.go:106–147  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

104}
105
106func TestFullAppSimulation(t *testing.T) {
107 config, db, dir, logger, skip, err := sim.SetupSimulation("leveldb-app-sim", "Simulation")
108 if skip {
109 t.Skip("skipping application simulation")
110 }
111
112 require.NoError(t, err, "simulation setup failed")
113
114 encodingConfig := sdkutil.MakeEncodingConfig()
115
116 akash.ModuleBasics().RegisterInterfaces(encodingConfig.InterfaceRegistry)
117
118 defer func() {
119 _ = db.Close()
120 require.NoError(t, os.RemoveAll(dir))
121 }()
122
123 appOpts := viper.New()
124 appOpts.Set("home", akash.DefaultHome)
125
126 r := rand.New(rand.NewSource(config.Seed)) // nolint: gosec
127 genTime := sdksim.RandTimestamp(r)
128
129 appOpts.Set("GenesisTime", genTime)
130
131 app1 := akash.NewApp(logger, db, nil, true, sim.FlagPeriodValue, map[int64]bool{}, encodingConfig, appOpts, fauxMerkleModeOpt, baseapp.SetChainID(AppChainID))
132
133 require.Equal(t, "akash", app1.Name())
134
135 fmt.Printf("config--------\n%v", config)
136 // run randomized simulation
137 _, simParams, simErr := simulateFromSeedFunc(t, app1, config)
138
139 // export state and simParams before the simulation error is checked
140 err = simtestutil.CheckExportSimulation(app1, config, simParams)
141 require.NoError(t, err)
142 require.NoError(t, simErr)
143
144 if config.Commit {
145 sim.PrintStats(db)
146 }
147}
148
149func TestAppImportExport(t *testing.T) {
150 config, encodingConfig, db, appOpts, logger, appA := setupSimulationApp(t, "skipping application import/export simulation")

Callers

nothing calls this directly

Calls 6

SetupSimulationFunction · 0.92
PrintStatsFunction · 0.92
simulateFromSeedFuncFunction · 0.85
CloseMethod · 0.65
NameMethod · 0.65
RegisterInterfacesMethod · 0.45

Tested by

no test coverage detected