Merge branch v2.11 into v3.3
This commit is contained in:
commit
c910ceeb00
18 changed files with 144 additions and 86 deletions
|
@ -1,12 +1,15 @@
|
|||
package httputil
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/traefik/traefik/v3/pkg/testhelpers"
|
||||
)
|
||||
|
||||
|
@ -100,3 +103,46 @@ func Test_directorBuilder(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_isTLSConfigError(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
err error
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
desc: "nil",
|
||||
},
|
||||
{
|
||||
desc: "TLS ECHRejectionError",
|
||||
err: &tls.ECHRejectionError{},
|
||||
},
|
||||
{
|
||||
desc: "TLS AlertError",
|
||||
err: tls.AlertError(0),
|
||||
},
|
||||
{
|
||||
desc: "Random error",
|
||||
err: errors.New("random error"),
|
||||
},
|
||||
{
|
||||
desc: "TLS RecordHeaderError",
|
||||
err: tls.RecordHeaderError{},
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
desc: "TLS CertificateVerificationError",
|
||||
err: &tls.CertificateVerificationError{},
|
||||
expected: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
actual := isTLSConfigError(test.err)
|
||||
require.Equal(t, test.expected, actual)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue