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) }