mirror of
https://github.com/openziti/ziti.git
synced 2026-09-10 16:55:41 +00:00
32 lines
510 B
Go
32 lines
510 B
Go
package handler_ctrl
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
type testTimeoutErr struct{}
|
|
|
|
func (t testTimeoutErr) Error() string {
|
|
return "test"
|
|
}
|
|
|
|
func (t testTimeoutErr) Timeout() bool {
|
|
return true
|
|
}
|
|
|
|
func (t testTimeoutErr) Temporary() bool {
|
|
return true
|
|
}
|
|
|
|
func Test_TimeoutCheck(t *testing.T) {
|
|
err := testTimeoutErr{}
|
|
req := assert.New(t)
|
|
req.True(isNetworkTimeout(err))
|
|
|
|
wrapped := fmt.Errorf("there was an error (%w)", err)
|
|
req.True(isNetworkTimeout(wrapped))
|
|
}
|