From 26783fcec5453e0ba4e102d77fa2fdde1f1ea51d Mon Sep 17 00:00:00 2001 From: Tom Moulard Date: Wed, 6 Jul 2022 17:05:53 +0200 Subject: [PATCH] review: add regression tests --- pkg/muxer/tcp/mux_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/muxer/tcp/mux_test.go b/pkg/muxer/tcp/mux_test.go index 8f1c3cb90e..50b8938cf7 100644 --- a/pkg/muxer/tcp/mux_test.go +++ b/pkg/muxer/tcp/mux_test.go @@ -1,6 +1,7 @@ package tcp import ( + "fmt" "net" "testing" "time" @@ -438,11 +439,23 @@ func Test_addTCPRoute(t *testing.T) { serverName: "bar", remoteAddr: "10.0.0.1:80", }, + { + desc: "Invalid ALPN rule matching ACME-TLS/1", + rule: fmt.Sprintf("ALPN(`%s`)", tlsalpn01.ACMETLS1Protocol), + protos: []string{"foo"}, + routeErr: true, + }, { desc: "Valid ALPN rule matching single protocol", rule: "ALPN(`foo`)", protos: []string{"foo"}, }, + { + desc: "Valid ALPN rule matching ACME-TLS/1 protocol", + rule: "ALPN(`foo`)", + protos: []string{tlsalpn01.ACMETLS1Protocol}, + matchErr: true, + }, { desc: "Valid ALPN rule not matching single protocol", rule: "ALPN(`foo`)",