From 9ac8dc77d069a48a79a3659f0c4ac2a8720d53c4 Mon Sep 17 00:00:00 2001 From: BugsGuru Date: Mon, 9 Dec 2024 13:57:58 +0800 Subject: [PATCH] fix ut TestMergeSQLsByFingerprint --- sqle/server/auditplan/task_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sqle/server/auditplan/task_test.go b/sqle/server/auditplan/task_test.go index 31534a347..9bae49bf5 100644 --- a/sqle/server/auditplan/task_test.go +++ b/sqle/server/auditplan/task_test.go @@ -25,7 +25,7 @@ func TestMergeSQLsByFingerprint(t *testing.T) { want: []sqlInfo{ { counter: 1, - fingerprint: "select sleep(?)", + fingerprint: "SELECT SLEEP(?)", sql: "select sleep(2)", }, }, @@ -44,7 +44,7 @@ func TestMergeSQLsByFingerprint(t *testing.T) { want: []sqlInfo{ { counter: 3, - fingerprint: "select sleep(?)", + fingerprint: "SELECT SLEEP(?)", sql: "select sleep(3)", }, }, @@ -53,7 +53,7 @@ func TestMergeSQLsByFingerprint(t *testing.T) { want: []sqlInfo{ { counter: 1, - fingerprint: "select * from tb1 where a=?", + fingerprint: "SELECT * FROM `tb1` WHERE `a`=?", sql: "select * from tb1 where a=1", }, }, @@ -72,7 +72,7 @@ func TestMergeSQLsByFingerprint(t *testing.T) { want: []sqlInfo{ { counter: 3, - fingerprint: "select * from tb1 where a=?", + fingerprint: "SELECT * FROM `tb1` WHERE `a`=?", sql: "select * from tb1 where a=3", }, }, @@ -94,12 +94,12 @@ func TestMergeSQLsByFingerprint(t *testing.T) { want: []sqlInfo{ { counter: 2, - fingerprint: "select * from tb1 where a=?", + fingerprint: "SELECT * FROM `tb1` WHERE `a`=?", sql: "select * from tb1 where a=3", }, { counter: 2, - fingerprint: "select sleep(?)", + fingerprint: "SELECT SLEEP(?)", sql: "select sleep(4)", }, }, @@ -109,7 +109,7 @@ func TestMergeSQLsByFingerprint(t *testing.T) { for i, tt := range tests { t.Run(fmt.Sprintf("test sqls NO.%v", i), func(t *testing.T) { actual := mergeSQLsByFingerprint(nil, tt.sqls) - if !assert.EqualValues(t, actual, tt.want) { + if !assert.EqualValues(t, tt.want, actual) { t.Fatal("unexpected result") } })