(ctx context.Context, request *cortexpb.WriteRequest)
| 58 | } |
| 59 | |
| 60 | func (m mockGprcServer) Push(ctx context.Context, request *cortexpb.WriteRequest) (*cortexpb.WriteResponse, error) { |
| 61 | defer request.Free() |
| 62 | time.Sleep(time.Duration(rand.Int31n(100)) * time.Millisecond) |
| 63 | md, _ := metadata.FromIncomingContext(ctx) |
| 64 | i, _ := strconv.Atoi(md["i"][0]) |
| 65 | expected := createRequest(i) |
| 66 | // Need to do this so the .String method return the same value for MessageWithBufRef |
| 67 | expected.MessageWithBufRef = request.MessageWithBufRef |
| 68 | |
| 69 | if expected.String() != request.String() { |
| 70 | return nil, fmt.Errorf("expected %v, got %v", expected, request) |
| 71 | } |
| 72 | return &cortexpb.WriteResponse{}, nil |
| 73 | } |
| 74 | |
| 75 | func run(t testing.TB, cfg server.Config, register func(s *grpc.Server), validate func(t testing.TB, con *grpc.ClientConn)) { |
| 76 | savedRegistry := prometheus.DefaultRegisterer |
no test coverage detected