Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ MAKEFLAGS = -s

export GOBIN=$(PWD)/bin
export GO111MODULE=on
export GODEBUG=tls13=0
export REWRITER=go/vt/sqlparser/rewriter.go

# Disabled parallel processing of target prerequisites to avoid that integration tests are racing each other (e.g. for ports) and may fail.
Expand Down
3 changes: 3 additions & 0 deletions go/mysql/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
versionTLS10 = "TLS10"
versionTLS11 = "TLS11"
versionTLS12 = "TLS12"
versionTLS13 = "TLS13"
versionTLSUnknown = "UnknownTLSVersion"
versionNoTLS = "None"
)
Expand Down Expand Up @@ -798,6 +799,8 @@ func tlsVersionToString(version uint16) string {
return versionTLS11
case tls.VersionTLS12:
return versionTLS12
case tls.VersionTLS13:
return versionTLS13
default:
return versionTLSUnknown
}
Expand Down
9 changes: 7 additions & 2 deletions go/mysql/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package mysql

import (
"crypto/tls"
"fmt"
"io/ioutil"
"net"
Expand Down Expand Up @@ -1006,7 +1007,11 @@ func TestTLSServer(t *testing.T) {
t.Errorf("Unexpected output for 'ssl echo': %v", results)
}

checkCountForTLSVer(t, versionTLS12, 1)
// Find out which TLS version the connection actually used,
// so we can check that the corresponding counter was incremented.
tlsVersion := conn.conn.(*tls.Conn).ConnectionState().Version

checkCountForTLSVer(t, tlsVersionToString(tlsVersion), 1)
checkCountForTLSVer(t, versionNoTLS, 0)
conn.Close()

Expand Down Expand Up @@ -1101,7 +1106,7 @@ func checkCountForTLSVer(t *testing.T, version string, expected int64) {
t.Errorf("Expected connection count for version %s to be %d, got %d", version, expected, count)
}
} else {
t.Errorf("No count found for version %s", version)
t.Errorf("No count for version %s found in %v", version, connCounts)
}
}

Expand Down