(b *testing.B)
| 92 | } |
| 93 | |
| 94 | func BenchmarkRPCComponents(b *testing.B) { |
| 95 | originLevel := log.GetLevel() |
| 96 | defer log.SetLevel(originLevel) |
| 97 | log.SetLevel(log.FatalLevel) |
| 98 | nodes, stop, err := setupEnvironment(1, AcceptNAConn) |
| 99 | if err != nil { |
| 100 | b.Fatal("failed to setup servers") |
| 101 | } |
| 102 | defer stop() |
| 103 | |
| 104 | b.Run("CallerWithPool", func(b *testing.B) { |
| 105 | pool := &ClientPool{} |
| 106 | defer func() { _ = pool.Close() }() |
| 107 | benchCaller(b, NewCallerWithPool(pool), nodes[0].ID) |
| 108 | }) |
| 109 | b.Run("CallerWithoutPool", func(b *testing.B) { |
| 110 | benchCaller(b, NewCallerWithPool(&nilPool{}), nodes[0].ID) |
| 111 | }) |
| 112 | b.Run("PCaller", func(b *testing.B) { |
| 113 | pool := &ClientPool{} |
| 114 | defer func() { _ = pool.Close() }() |
| 115 | benchPCaller(b, NewPersistentCallerWithPool(pool, nodes[0].ID)) |
| 116 | }) |
| 117 | } |
| 118 | |
| 119 | func TestRPCComponents(t *testing.T) { |
| 120 | Convey("Setup a single server for pool test", t, func(c C) { |
nothing calls this directly
no test coverage detected