diff options
author | Kjell Kvinge <kjell@kvinge.biz> | 2017-01-03 03:52:09 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-01-03 10:52:09 +0800 |
commit | 4b0974ec10e6b43dd38cacda43424ee0cdde039e (patch) | |
tree | d830a8a62d231ed802fe2d9a3c7f4697701b688e /models/graph_test.go | |
parent | 7be02d9020180dd602287cce8ea9ebb45099a476 (diff) | |
download | gitea-4b0974ec10e6b43dd38cacda43424ee0cdde039e.tar.gz gitea-4b0974ec10e6b43dd38cacda43424ee0cdde039e.zip |
Fix benchmarktests (#557)
Diffstat (limited to 'models/graph_test.go')
-rw-r--r-- | models/graph_test.go | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/models/graph_test.go b/models/graph_test.go index 23d8aa8492..47c9dbb084 100644 --- a/models/graph_test.go +++ b/models/graph_test.go @@ -17,25 +17,29 @@ func BenchmarkGetCommitGraph(b *testing.B) { b.Error("Could not open repository") } - graph, err := GetCommitGraph(currentRepo) - if err != nil { - b.Error("Could get commit graph") - } - - if len(graph) < 100 { - b.Error("Should get 100 log lines.") + for i := 0; i < b.N; i++ { + graph, err := GetCommitGraph(currentRepo) + if err != nil { + b.Error("Could get commit graph") + } + + if len(graph) < 100 { + b.Error("Should get 100 log lines.") + } } } func BenchmarkParseCommitString(b *testing.B) { testString := "* DATA:||4e61bacab44e9b4730e44a6615d04098dd3a8eaf|2016-12-20 21:10:41 +0100|Kjell Kvinge|kjell@kvinge.biz|4e61bac|Add route for graph" - graphItem, err := graphItemFromString(testString, nil) - if err != nil { - b.Error("could not parse teststring") - } + for i := 0; i < b.N; i++ { + graphItem, err := graphItemFromString(testString, nil) + if err != nil { + b.Error("could not parse teststring") + } - if graphItem.Author != "Kjell Kvinge" { - b.Error("Did not get expected data") + if graphItem.Author != "Kjell Kvinge" { + b.Error("Did not get expected data") + } } } |