diff --git a/util/encrypt/aes_test.go b/util/encrypt/aes_test.go index 9be296863f331..3b0bf822cd45f 100644 --- a/util/encrypt/aes_test.go +++ b/util/encrypt/aes_test.go @@ -298,8 +298,7 @@ func TestAESEncryptWithCBC(t *testing.T) { } } -func (s *testEncryptSuite) TestAESEncryptWithOFB(c *C) { - defer testleak.AfterTest(c)() +func TestAESEncryptWithOFB(t *testing.T) { tests := []struct { str string key string @@ -317,19 +316,19 @@ func (s *testEncryptSuite) TestAESEncryptWithOFB(c *C) { {"pingcap", "123456789012345", "1234567890123456", "", true}, } - for _, t := range tests { - str := []byte(t.str) - key := []byte(t.key) - iv := []byte(t.iv) + for _, tt := range tests { + str := []byte(tt.str) + key := []byte(tt.key) + iv := []byte(tt.iv) crypted, err := AESEncryptWithOFB(str, key, iv) - if t.isError { - c.Assert(err, NotNil, Commentf("%v", t)) + if tt.isError { + require.Errorf(t, err, "%v", tt) continue } - c.Assert(err, IsNil, Commentf("%v", t)) + require.NoErrorf(t, err, "%v", tt) result := toHex(crypted) - c.Assert(result, Equals, t.expect, Commentf("%v", t)) + require.Equalf(t, tt.expect, result, "%v", tt) } }