Skip to content

Run tests with a newer version of Go #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2021
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
13 changes: 4 additions & 9 deletions db/mysql_connection_string_builder_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package db_test

import (
"crypto/tls"
"crypto/x509"
"encoding/pem"
"errors"
Expand All @@ -15,8 +14,7 @@ import (
)

const (

DATABASE_CLIENT_CERT = `-----BEGIN CERTIFICATE-----
DATABASE_CLIENT_CERT = `-----BEGIN CERTIFICATE-----
MIIEOTCCAiECFFQB88eMvRFzig5vh+MJyi0LpnODMA0GCSqGSIb3DQEBCwUAMFcx
CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRl
cm5ldCBXaWRnaXRzIFB0eSBMdGQxEDAOBgNVBAMMB215c3FsQ0EwHhcNMjAwNzIx
Expand All @@ -42,7 +40,6 @@ Gim3GXnxjUDAUZOd88665Y2iirAmG1TcMDek0lBu7/ysuxjBK+Ef3BQ0YONQvzmn
mSvPMfv+Qs4rTUvQi9ISXSWS9WDxye35Y/H5Zas=
-----END CERTIFICATE-----`


DATABASE_CLIENT_KEY = `-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAoCDk9QQsut5x0te6zRc9UmJ5lT4qMk26SrQ+hGUyVYj4dP4h
tzsgwqoPRdDGNeunU+lDCdGWe0IpbnU5Lh2kEQaNF4E0+vNKF+AvUBw5Bcm1+FDX
Expand Down Expand Up @@ -169,10 +166,8 @@ var _ = Describe("MySQLConnectionStringBuilder", func() {
Expect(mySQLAdapter.RegisterTLSConfigCallCount()).To(Equal(1))
passedTLSConfigName, passedTLSConfig := mySQLAdapter.RegisterTLSConfigArgsForCall(0)
Expect(passedTLSConfigName).To(Equal("some-database-tls"))
Expect(passedTLSConfig).To(Equal(&tls.Config{
InsecureSkipVerify: false,
RootCAs: caCertPool,
}))
Expect(passedTLSConfig.InsecureSkipVerify).To(Equal(false))
Expect(passedTLSConfig.RootCAs.Subjects()).To(Equal(caCertPool.Subjects()))
})

Context("when SkipHostnameValidation is true", func() {
Expand All @@ -189,7 +184,7 @@ var _ = Describe("MySQLConnectionStringBuilder", func() {
passedTLSConfigName, passedTLSConfig := mySQLAdapter.RegisterTLSConfigArgsForCall(0)
Expect(passedTLSConfigName).To(Equal("some-database-tls"))
Expect(passedTLSConfig.InsecureSkipVerify).To(BeTrue())
Expect(passedTLSConfig.RootCAs).To(Equal(caCertPool))
Expect(passedTLSConfig.RootCAs.Subjects()).To(Equal(caCertPool.Subjects()))
Expect(passedTLSConfig.Certificates).To(BeNil())
// impossible to assert VerifyPeerCertificate is set to a specfic function
Expect(passedTLSConfig.VerifyPeerCertificate).NotTo(BeNil())
Expand Down
1 change: 1 addition & 0 deletions mutualtls/mutualtls.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func newTLSConfig(certFile, keyFile string) (*tls.Config, error) {
tlsConfig := &tls.Config{
Certificates: []tls.Certificate{keyPair},
MinVersion: tls.VersionTLS12,
MaxVersion: tls.VersionTLS12,
}
return tlsConfig, nil
}
Expand Down
1 change: 1 addition & 0 deletions mutualtls/mutualtls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ var _ = Describe("TLS config for internal API server", func() {

It("refuses the connection from the client", func() {
_, err := makeRequest(serverListenAddr, clientTLSConfig)

Expect(err).To(MatchError(ContainSubstring("remote error")))
})
})
Expand Down