You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
456 B
Go
22 lines
456 B
Go
4 years ago
|
package serverinterceptors
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"testing"
|
||
|
"time"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"google.golang.org/grpc"
|
||
|
)
|
||
|
|
||
|
func TestUnaryTimeoutInterceptor(t *testing.T) {
|
||
|
interceptor := UnaryTimeoutInterceptor(time.Millisecond * 10)
|
||
|
_, err := interceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||
|
FullMethod: "/",
|
||
|
}, func(
|
||
|
ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
return nil, nil
|
||
|
})
|
||
|
assert.Nil(t, err)
|
||
|
}
|