Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arjan-bal committed May 9, 2024
1 parent 07e02c5 commit a04abeb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions credentials/tls_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,12 @@ func (s) TestTLS_CipherSuitesOverridable(t *testing.T) {
// TestTLS_DisabledALPN tests the behaviour of a gRPC client when connecting to
// a server that doesn't support ALPN.
func (s) TestTLS_DisabledALPN(t *testing.T) {

initialVal := envconfig.EnforceALPNEnabled
defer func() {
envconfig.EnforceALPNEnabled = initialVal
}()

// Start a non gRPC TLS server.
config := &tls.Config{
serverCfg := &tls.Config{
Certificates: []tls.Certificate{serverCert},
NextProtos: []string{}, // Empty list indicates ALPN is disabled.
}
Expand All @@ -271,11 +269,12 @@ func (s) TestTLS_DisabledALPN(t *testing.T) {

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
listner, err := tls.Listen("tcp", "localhost:0", config)
envconfig.EnforceALPNEnabled = tc.alpnEnforced

listner, err := tls.Listen("tcp", "localhost:0", serverCfg)
if err != nil {
t.Fatalf("Error starting TLS server: %v", err)
}
envconfig.EnforceALPNEnabled = tc.alpnEnforced

go func() {
conn, err := listner.Accept()
Expand Down

0 comments on commit a04abeb

Please sign in to comment.