(t *testing.T, dg *dgo.Dgraph)
| 52 | } |
| 53 | |
| 54 | func increment(t *testing.T, dg *dgo.Dgraph) int { |
| 55 | var max int |
| 56 | var mu sync.Mutex |
| 57 | storeMax := func(a int) { |
| 58 | mu.Lock() |
| 59 | if max < a { |
| 60 | max = a |
| 61 | } |
| 62 | mu.Unlock() |
| 63 | } |
| 64 | |
| 65 | var wg sync.WaitGroup |
| 66 | // N goroutines, process N times each goroutine. |
| 67 | for i := 0; i < N; i++ { |
| 68 | wg.Add(1) |
| 69 | go func() { |
| 70 | defer wg.Done() |
| 71 | max := incrementInLoop(t, dg, N) |
| 72 | storeMax(max) |
| 73 | }() |
| 74 | } |
| 75 | wg.Wait() |
| 76 | return max |
| 77 | } |
| 78 | |
| 79 | func read(t *testing.T, dg *dgo.Dgraph, expected int) { |
| 80 | conf := viper.New() |
no test coverage detected