Skip to content

Commit

Permalink
*: pin go1.20 (#41604)
Browse files Browse the repository at this point in the history
close #40969
  • Loading branch information
hawkingrei authored Feb 20, 2023
1 parent 90412c4 commit e3896bd
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 32 deletions.
6 changes: 3 additions & 3 deletions build/image/base
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ FROM hub.pingcap.net/jenkins/centos7_jenkins
USER root
WORKDIR /root

ENV GOLANG_VERSION 1.19.5
ENV GOLANG_VERSION 1.20.1
ENV GOLANG_DOWNLOAD_URL https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 36519702ae2fd573c9869461990ae550c8c0d955cd28d2827a6b159fda81ff95
ENV GOLANG_DOWNLOAD_SHA256 000a5b1fca4f75895f78befeb2eecf10bfff3c428597f3f1e69133b63b911b02
ENV GOPATH /go
ENV GOROOT /usr/local/go
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
ADD https://github.com/bazelbuild/bazel/releases/download/5.3.2/bazel-5.3.2-linux-x86_64 /usr/bin/bazel
ADD https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64 /usr/bin/bazel
ADD https://uploader.codecov.io/latest/linux/codecov /usr/bin/codecov
RUN curl https://setup.ius.io | sh || true && \
chmod u+x /usr/bin/bazel && yum update -y && \
Expand Down
2 changes: 1 addition & 1 deletion build/image/centos7_jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM hub.pingcap.net/wangweizhen/base_image:go11920230111
FROM hub.pingcap.net/wangweizhen/base_image:go12020230220
USER root
WORKDIR /root
COPY .ci_bazel /data/bazel
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pingcap/tidb

go 1.19
go 1.20

require (
cloud.google.com/go/storage v1.27.0
Expand Down
31 changes: 25 additions & 6 deletions server/tidb_serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package server

import (
"context"
"crypto/tls"
"crypto/x509"
"os"
"path/filepath"
Expand All @@ -33,6 +34,26 @@ import (
"github.com/stretchr/testify/require"
)

// isTLSExpiredError checks error is caused by TLS expired.
func isTLSExpiredError(err error) bool {
err = errors.Cause(err)
switch inval := err.(type) {
case x509.CertificateInvalidError:
if inval.Reason != x509.Expired {
return false
}
case *tls.CertificateVerificationError:
invalid, ok := inval.Err.(x509.CertificateInvalidError)
if !ok || invalid.Reason != x509.Expired {
return false
}
return true
default:
return false
}
return true
}

// this test will change `kv.TxnTotalSizeLimit` which may affect other test suites,
// so we must make it running in serial.
func TestLoadData1(t *testing.T) {
Expand Down Expand Up @@ -209,7 +230,6 @@ func TestTLSBasic(t *testing.T) {
}

func TestTLSVerify(t *testing.T) {
t.Skip("remove skip after upgrading go1.20.1")
ts := createTidbTestSuite(t)

dir := t.TempDir()
Expand Down Expand Up @@ -263,9 +283,9 @@ func TestTLSVerify(t *testing.T) {
require.NoError(t, err)
cli.runTestRegression(t, connOverrider, "TLSRegression")

require.False(t, util.IsTLSExpiredError(errors.New("unknown test")))
require.False(t, util.IsTLSExpiredError(x509.CertificateInvalidError{Reason: x509.CANotAuthorizedForThisName}))
require.True(t, util.IsTLSExpiredError(x509.CertificateInvalidError{Reason: x509.Expired}))
require.False(t, isTLSExpiredError(errors.New("unknown test")))
require.False(t, isTLSExpiredError(x509.CertificateInvalidError{Reason: x509.CANotAuthorizedForThisName}))
require.True(t, isTLSExpiredError(x509.CertificateInvalidError{Reason: x509.Expired}))

_, _, err = util.LoadTLSCertificates("", "wrong key", "wrong cert", true, 528)
require.Error(t, err)
Expand Down Expand Up @@ -455,7 +475,6 @@ func TestDefaultCharacterAndCollation(t *testing.T) {
}

func TestReloadTLS(t *testing.T) {
t.Skip("remove skip after upgrading go1.20.1")
ts := createTidbTestSuite(t)

// Generate valid TLS certificates.
Expand Down Expand Up @@ -554,6 +573,6 @@ func TestReloadTLS(t *testing.T) {
}
err = cli.runTestTLSConnection(t, connOverrider)
require.NotNil(t, err)
require.Truef(t, util.IsTLSExpiredError(err), "real error is %+v", err)
require.Truef(t, isTLSExpiredError(err), "real error is %+v", err)
server.Close()
}
21 changes: 0 additions & 21 deletions util/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,27 +551,6 @@ func LoadTLSCertificates(ca, key, cert string, autoTLS bool, rsaKeySize int) (tl
return
}

// IsTLSExpiredError checks error is caused by TLS expired.
func IsTLSExpiredError(err error) bool {
err = errors.Cause(err)
switch inval := err.(type) {
case x509.CertificateInvalidError:
if inval.Reason != x509.Expired {
return false
}
// TODO: remove it after upgrading 1.20
// case *tls.CertificateVerificationError:
// invali, ok := inval.Err.(x509.CertificateInvalidError)
// if !ok || invali.Reason != x509.Expired {
// return false
// }
// return true
default:
return false
}
return true
}

var (
internalClientInit sync.Once
internalHTTPClient *http.Client
Expand Down

0 comments on commit e3896bd

Please sign in to comment.