(t *testing.T, dg *dgo.Dgraph, M int)
| 29 | const N = 10 |
| 30 | |
| 31 | func incrementInLoop(t *testing.T, dg *dgo.Dgraph, M int) int { |
| 32 | conf := viper.New() |
| 33 | conf.Set("pred", "counter.val") |
| 34 | |
| 35 | var max int |
| 36 | for i := 0; i < M; i++ { |
| 37 | cnt, err := process(dg, conf) |
| 38 | if err != nil { |
| 39 | if strings.Contains(err.Error(), "Transaction has been aborted") { |
| 40 | // pass |
| 41 | } else { |
| 42 | t.Logf("Error while incrementing: %v\n", err) |
| 43 | } |
| 44 | } else { |
| 45 | if cnt.Val > max { |
| 46 | max = cnt.Val |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | t.Logf("Last value written by increment in loop: %d", max) |
| 51 | return max |
| 52 | } |
| 53 | |
| 54 | func increment(t *testing.T, dg *dgo.Dgraph) int { |
| 55 | var max int |
no test coverage detected