Skip to content

Commit

Permalink
improve unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
hasa1K committed Oct 18, 2023
1 parent 949fdb5 commit add3ae5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sqle/driver/mysql/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3983,6 +3983,18 @@ func Test_DMLCheckInQueryLimit(t *testing.T) {
"select * from exist_tb_1 where id in (select id from exist_tb_1 where id in (1,2,3,4,5,6,7) and v1 in ('a', 'b', 'c'))",
newTestResult().addResult(rulepkg.DMLCheckInQueryNumber, 7, paramValue))

runSingleRuleInspectCase(rule, t, "", DefaultMysqlInspect(),
"select * from exist_tb_1 where id in (select id from exist_tb_1 where id in (1,2,3,4,5,6,7) and v1 in ('a', 'b', 'c', 'd', 'e', 'f'))",
newTestResult().addResult(rulepkg.DMLCheckInQueryNumber, 7, paramValue).addResult(rulepkg.DMLCheckInQueryNumber, 6, paramValue))

runSingleRuleInspectCase(rule, t, "", DefaultMysqlInspect(),
"delete from exist_tb_1 where id in (select id from exist_tb_1 where id in (1,2,3,4,5,6,7) and v1 in ('a', 'b', 'c', 'd', 'e', 'f'))",
newTestResult().addResult(rulepkg.DMLCheckInQueryNumber, 7, paramValue).addResult(rulepkg.DMLCheckInQueryNumber, 6, paramValue))

runSingleRuleInspectCase(rule, t, "", DefaultMysqlInspect(),
"update exist_tb_1 set v1 = 'v1_next' where id in (select id from exist_tb_1 where id in (1,2,3,4,5,6,7) and v1 in ('a', 'b', 'c', 'd', 'e', 'f'))",
newTestResult().addResult(rulepkg.DMLCheckInQueryNumber, 7, paramValue).addResult(rulepkg.DMLCheckInQueryNumber, 6, paramValue))

runSingleRuleInspectCase(rule, t, "", DefaultMysqlInspect(),
"select 1 in (1,2,3,4,5,6);",
newTestResult())
Expand Down

0 comments on commit add3ae5

Please sign in to comment.