(t *testing.T)
| 151 | } |
| 152 | |
| 153 | func TestBenchSetup(t *testing.T) { |
| 154 | bench := NewBenchmark("test", 1, 1) |
| 155 | bench.AddSubSample(millionMessagesSecondSample(1)) |
| 156 | bench.AddPubSample(millionMessagesSecondSample(1)) |
| 157 | bench.Close() |
| 158 | if len(bench.RunID) == 0 { |
| 159 | t.Fatal("Bench doesn't have a RunID") |
| 160 | } |
| 161 | if len(bench.Pubs.Samples) != 1 { |
| 162 | t.Fatal("Expected one publisher") |
| 163 | } |
| 164 | if len(bench.Subs.Samples) != 1 { |
| 165 | t.Fatal("Expected one subscriber") |
| 166 | } |
| 167 | if bench.MsgCnt != 2*Million { |
| 168 | t.Fatal("Expected 2 million msgs") |
| 169 | } |
| 170 | if bench.IOBytes != 2*Million*MsgSize { |
| 171 | t.Fatalf("Expected %d million bytes", 2*MsgSize) |
| 172 | } |
| 173 | if bench.Duration() != time.Second { |
| 174 | t.Fatal("Expected duration to be 1 second") |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | func makeBench(subs, pubs int) *Benchmark { |
| 179 | bench := NewBenchmark("test", subs, pubs) |
nothing calls this directly
no test coverage detected