Files
sponge/pkg/grpc/interceptor/timeout_test.go
zhuyasen 891af10cb6 add test
2022-09-25 19:06:27 +08:00

27 lines
480 B
Go

package interceptor
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestStreamTimeout(t *testing.T) {
interceptor := StreamTimeout(time.Second)
assert.NotNil(t, interceptor)
}
func TestUnaryTimeout(t *testing.T) {
interceptor := UnaryTimeout(time.Second)
assert.NotNil(t, interceptor)
}
func Test_defaultContextTimeout(t *testing.T) {
_, cancel := defaultContextTimeout(context.Background())
if cancel != nil {
defer cancel()
}
}