(b *testing.B)
| 11 | ) |
| 12 | |
| 13 | func BenchmarkSignRequest(b *testing.B) { |
| 14 | ctx := context.Background() |
| 15 | ctx = user.InjectOrgID(ctx, "user-1") |
| 16 | |
| 17 | tests := []struct { |
| 18 | size int |
| 19 | }{ |
| 20 | {size: 10}, |
| 21 | {size: 100}, |
| 22 | {size: 1000}, |
| 23 | {size: 10000}, |
| 24 | } |
| 25 | |
| 26 | for _, tc := range tests { |
| 27 | b.Run(fmt.Sprintf("WriteRequestSize: %v", tc.size), func(b *testing.B) { |
| 28 | wr := createWriteRequest(tc.size, true, "family1", "help1", "unit") |
| 29 | b.ReportAllocs() |
| 30 | for b.Loop() { |
| 31 | _, err := wr.Sign(ctx) |
| 32 | require.NoError(b, err) |
| 33 | } |
| 34 | }) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | func TestWriteRequest_Sign(t *testing.T) { |
| 39 | ctx := context.Background() |
nothing calls this directly
no test coverage detected