From 606d76adeca3df05b1f0fb1f2c4ba70300205a1b Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Mon, 22 Feb 2021 21:41:09 -0600 Subject: [PATCH] cherry pick #22731 to release-5.0-rc Signed-off-by: ti-srebot --- .github/labeler.yml | 4 ++++ executor/brie.go | 5 +++++ executor/brie_test.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 executor/brie_test.go diff --git a/.github/labeler.yml b/.github/labeler.yml index dc15adb5d9ad6..3c965914e3893 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,6 +1,7 @@ sig/execution: - distsql/* - executor/* + - !executor/brie* - util/chunk/* - util/disk/* - util/execdetails/* @@ -31,3 +32,6 @@ sig/DDL: component/config: - config/* + +sig/migrate: + - executor/brie* diff --git a/executor/brie.go b/executor/brie.go index 6bc9e664227f7..492a3d68d8121 100644 --- a/executor/brie.go +++ b/executor/brie.go @@ -42,6 +42,7 @@ import ( "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" + "github.com/pingcap/tidb/util/printer" "github.com/pingcap/tidb/util/sqlexec" ) @@ -466,3 +467,7 @@ func (gs *tidbGlueSession) Record(name string, value uint64) { gs.info.archiveSize = value } } + +func (gs *tidbGlueSession) GetVersion() string { + return "TiDB\n" + printer.GetTiDBInfo() +} diff --git a/executor/brie_test.go b/executor/brie_test.go new file mode 100644 index 0000000000000..4393e9552128b --- /dev/null +++ b/executor/brie_test.go @@ -0,0 +1,28 @@ +// Copyright 2021 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package executor + +import . "github.com/pingcap/check" + +type testBRIESuite struct{} + +var _ = Suite(&testBRIESuite{}) + +func (s *testPartitionSuite) TestGlueGetVersion(c *C) { + g := tidbGlueSession{} + version := g.GetVersion() + c.Assert(version, Matches, `(.|\n)*Release Version(.|\n)*`) + c.Assert(version, Matches, `(.|\n)*Git Commit Hash(.|\n)*`) + c.Assert(version, Matches, `(.|\n)*GoVersion(.|\n)*`) +}