prometheusinterceptor_test.go 430 B

12345678910111213141516171819
  1. package serverinterceptors
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. "google.golang.org/grpc"
  7. )
  8. func TestUnaryPromMetricInterceptor(t *testing.T) {
  9. interceptor := UnaryPrometheusInterceptor()
  10. _, err := interceptor(context.Background(), nil, &grpc.UnaryServerInfo{
  11. FullMethod: "/",
  12. }, func(ctx context.Context, req interface{}) (interface{}, error) {
  13. return nil, nil
  14. })
  15. assert.Nil(t, err)
  16. }