From 2ac2c49afdc7c4a347ff502476ee535588396554 Mon Sep 17 00:00:00 2001 From: tison Date: Sat, 13 Nov 2021 15:30:05 +0800 Subject: [PATCH] br: migrate test-infra to testify for redact This closes #28176 . Signed-off-by: tison --- br/pkg/redact/redact_test.go | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/br/pkg/redact/redact_test.go b/br/pkg/redact/redact_test.go index 9ee743292519a..5647a681974f3 100644 --- a/br/pkg/redact/redact_test.go +++ b/br/pkg/redact/redact_test.go @@ -3,29 +3,24 @@ package redact_test import ( + "encoding/hex" "testing" - . "github.com/pingcap/check" "github.com/pingcap/tidb/br/pkg/redact" + "github.com/stretchr/testify/require" + "go.uber.org/goleak" ) -type testRedactSuite struct{} +func TestRedact(t *testing.T) { + defer goleak.VerifyNone(t) -func (s *testRedactSuite) SetUpSuite(c *C) {} -func (s *testRedactSuite) TearDownSuite(c *C) {} - -var _ = Suite(&testRedactSuite{}) - -func TestT(t *testing.T) {} - -func (s *testRedactSuite) TestRedact(c *C) { redacted, secret := "?", "secret" redact.InitRedact(false) - c.Assert(redact.String(secret), Equals, secret) - c.Assert(redact.Key([]byte(secret)), Equals, secret) + require.Equal(t, redact.String(secret), secret) + require.Equal(t, redact.Key([]byte(secret)), hex.EncodeToString([]byte(secret))) redact.InitRedact(true) - c.Assert(redact.String(secret), Equals, redacted) - c.Assert(redact.Key([]byte(secret)), Equals, redacted) + require.Equal(t, redact.String(secret), redacted) + require.Equal(t, redact.Key([]byte(secret)), redacted) }