Merge PR #221: Hide unnecessarily exported function to better coverage report

This commit is contained in:
Alessio Treglia
2019-12-12 14:59:48 +00:00
committed by Alexander Bezobchuk
parent ed036f6c83
commit dcbddd9f04
2 changed files with 16 additions and 17 deletions

View File

@@ -78,7 +78,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
// export state and params before the simulation error is checked
if config.ExportStatePath != "" {
if err := ExportStateToJSON(app, config.ExportStatePath); err != nil {
if err := exportStateToJSON(app, config.ExportStatePath); err != nil {
fmt.Println(err)
b.Fail()
}
@@ -140,7 +140,7 @@ func TestFullAppSimulation(t *testing.T) {
// export state and params before the simulation error is checked
if config.ExportStatePath != "" {
err := ExportStateToJSON(app, config.ExportStatePath)
err := exportStateToJSON(app, config.ExportStatePath)
require.NoError(t, err)
}
@@ -197,7 +197,7 @@ func TestAppImportExport(t *testing.T) {
// export state and simParams before the simulation error is checked
if config.ExportStatePath != "" {
err := ExportStateToJSON(app, config.ExportStatePath)
err := exportStateToJSON(app, config.ExportStatePath)
require.NoError(t, err)
}
@@ -319,7 +319,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
// export state and params before the simulation error is checked
if config.ExportStatePath != "" {
err := ExportStateToJSON(app, config.ExportStatePath)
err := exportStateToJSON(app, config.ExportStatePath)
require.NoError(t, err)
}
@@ -463,7 +463,7 @@ func BenchmarkInvariants(b *testing.B) {
// export state and params before the simulation error is checked
if config.ExportStatePath != "" {
if err := ExportStateToJSON(app, config.ExportStatePath); err != nil {
if err := exportStateToJSON(app, config.ExportStatePath); err != nil {
fmt.Println(err)
b.Fail()
}
@@ -497,3 +497,14 @@ func BenchmarkInvariants(b *testing.B) {
})
}
}
// auxiliary function to export the app state to JSON
func exportStateToJSON(app *GaiaApp, path string) error {
fmt.Println("exporting app state...")
appState, _, err := app.ExportAppStateAndValidators(false, nil)
if err != nil {
return err
}
return ioutil.WriteFile(path, []byte(appState), 0644)
}