(size int)
| 462 | } |
| 463 | |
| 464 | func generateString(size int) string { |
| 465 | // Use random bytes, to avoid compression. |
| 466 | buf := make([]byte, size) |
| 467 | _, err := rand.Read(buf) |
| 468 | if err != nil { |
| 469 | // Should not happen. |
| 470 | panic(err) |
| 471 | } |
| 472 | |
| 473 | // To avoid invalid UTF-8 sequences (which protobuf complains about), we cleanup the data a bit. |
| 474 | for ix, b := range buf { |
| 475 | if b < ' ' { |
| 476 | b += ' ' |
| 477 | } |
| 478 | b = b & 0x7f |
| 479 | buf[ix] = b |
| 480 | } |
| 481 | return string(buf) |
| 482 | } |
| 483 | |
| 484 | func TestGrpcStreamTracker(t *testing.T) { |
| 485 | tracker := NewStreamTracker(prometheus.NewDesc( |
no test coverage detected