From a13e8d0379769f2864b6c0e6f8d969a6829f0743 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Thu, 26 Sep 2019 16:14:10 -0400 Subject: [PATCH] fix invariant benchmarking --- app/sim_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/sim_test.go b/app/sim_test.go index edcb94b8..298acccc 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -681,9 +681,11 @@ func BenchmarkInvariants(b *testing.B) { // their respective metadata which makes it useful for testing/benchmarking. for _, cr := range app.crisisKeeper.Routes() { b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { - if res, stop := cr.Invar(ctx); stop { - fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res) - b.FailNow() + for n := 0; n < b.N; n++ { + if res, stop := cr.Invar(ctx); stop { + fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res) + b.FailNow() + } } }) }