From 52ae46cea66e69d6a3d2f832b37eeb1166ce291d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 18 May 2021 22:55:51 +0200 Subject: [PATCH] Fix running of auth tests --- auth/auth_test.go | 6 ++++++ test.sh | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/auth/auth_test.go b/auth/auth_test.go index 93f0ade6f..6ccc4df05 100644 --- a/auth/auth_test.go +++ b/auth/auth_test.go @@ -14,6 +14,8 @@ package auth import ( + "testing" + . "github.com/pingcap/check" ) @@ -22,6 +24,10 @@ var _ = Suite(&testAuthSuite{}) type testAuthSuite struct { } +func TestT(t *testing.T) { + TestingT(t) +} + func (s *testAuthSuite) TestEncodePassword(c *C) { pwd := "123" c.Assert(EncodePassword(pwd), Equals, "*23AE809DDACAF96AF0FD78ED04B6A265E05AA257") diff --git a/test.sh b/test.sh index e6988a06c..ce4ae4cb1 100644 --- a/test.sh +++ b/test.sh @@ -1 +1,14 @@ +#!/bin/sh + +# If 'check.TestingT' is not used in any of the *_test.go files in a subdir no tests will run. + +for f in $(git grep -l 'github.com/pingcap/check' | grep '/' | cut -d/ -f1 | uniq) +do + if ! grep -r TestingT "$f" > /dev/null + then + echo "check.TestingT missing from $f" + exit 1 + fi +done + GO111MODULE=on go test -p 1 -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=./... ./...