From 500f79a150948aea573ee7c8d3c770e2342c8983 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 26 Jun 2017 08:52:20 +0300 Subject: [PATCH 1/3] MXS-1296: Test that lc statements are parsed correctly The transaction boundary parser - TrxBoundaryParser - must handle upper and lowercase statements correctly. --- server/core/test/testtrxtracking.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/server/core/test/testtrxtracking.cc b/server/core/test/testtrxtracking.cc index 7ee715f15..9f0e67b7b 100644 --- a/server/core/test/testtrxtracking.cc +++ b/server/core/test/testtrxtracking.cc @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -69,6 +70,7 @@ struct test_case uint32_t type_mask; } test_cases[] = { + // Keep these all uppercase, lowercase are tested programmatically. { "BEGIN", QUERY_TYPE_BEGIN_TRX }, { "BEGIN WORK", QUERY_TYPE_BEGIN_TRX }, @@ -299,14 +301,23 @@ bool test(uint32_t (*getter)(GWBUF*), bool dont_bail_out) string base(pTest->zStmt); cout << base << endl; - string s; - - s = base; - if (!test(getter, s.c_str(), pTest->type_mask)) + if (!test(getter, base.c_str(), pTest->type_mask)) { rc = false; } + if (dont_bail_out || rc) + { + // Test all lowercase. + string lc(base); + transform(lc.begin(), lc.end(), lc.begin(), ::tolower); + + if (!test(getter, lc.c_str(), pTest->type_mask)) + { + rc = false; + } + } + if (dont_bail_out || rc) { if (!test_with_prefixes(getter, base, pTest->type_mask)) From 90ab2bc1065ef58463f23821118c553ebc4d769c Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 26 Jun 2017 12:09:18 +0300 Subject: [PATCH 2/3] Update 2.1 version --- VERSION21.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION21.cmake b/VERSION21.cmake index c79617932..ba1a23389 100644 --- a/VERSION21.cmake +++ b/VERSION21.cmake @@ -5,7 +5,7 @@ set(MAXSCALE_VERSION_MAJOR "2" CACHE STRING "Major version") set(MAXSCALE_VERSION_MINOR "1" CACHE STRING "Minor version") -set(MAXSCALE_VERSION_PATCH "3" CACHE STRING "Patch version") +set(MAXSCALE_VERSION_PATCH "4" CACHE STRING "Patch version") # This should only be incremented if a package is rebuilt set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number") From 9737ffe092e1658ff1e656e934ff48f0c55117fc Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Mon, 26 Jun 2017 12:18:48 +0200 Subject: [PATCH 3/3] Fix masking tests The masking filter now has a default fill value, so that if a provided value does not match, then "X" is used. The tests were modified to use "Y" as an explicitly provided fill value (to distinguish from the default "X") and the results were the default fill value would kick in were modified accordingly. --- .../masking_mysqltest/masking_rules.json | 4 +-- .../masking_mysqltest/r/masking_column.result | 22 +++++++-------- .../r/masking_replace.result | 6 ++-- .../masking_mysqltest/r/masking_smoke.result | 28 +++++++++---------- .../masking_mysqltest/t/masking_replace.test | 26 ++++++++--------- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/maxscale-system-test/masking/masking_mysqltest/masking_rules.json b/maxscale-system-test/masking/masking_mysqltest/masking_rules.json index 76ee2f24a..d010b5358 100644 --- a/maxscale-system-test/masking/masking_mysqltest/masking_rules.json +++ b/maxscale-system-test/masking/masking_mysqltest/masking_rules.json @@ -5,7 +5,7 @@ "column": "a" }, "with": { - "fill": "X" + "fill": "Y" } }, { @@ -22,7 +22,7 @@ }, "with": { "value": "012345-ABCD", - "fill": "X" + "fill": "Y" } } ] diff --git a/maxscale-system-test/masking/masking_mysqltest/r/masking_column.result b/maxscale-system-test/masking/masking_mysqltest/r/masking_column.result index fb9cfd59f..9fd91f52b 100644 --- a/maxscale-system-test/masking/masking_mysqltest/r/masking_column.result +++ b/maxscale-system-test/masking/masking_mysqltest/r/masking_column.result @@ -11,12 +11,12 @@ insert into masking values ("hello", NULL, NULL); insert into masking values (NULL, NULL, NULL); select * from masking; a x y -XXXXX hello hello +YYYYY hello hello NULL hello hello -XXXXX NULL hello -XXXXX hello NULL +YYYYY NULL hello +YYYYY hello NULL NULL NULL hello -XXXXX NULL NULL +YYYYY NULL NULL NULL NULL NULL drop table masking; create table masking (x TEXT, a TEXT, y TEXT); @@ -29,10 +29,10 @@ insert into masking values ("hello", NULL, NULL); insert into masking values (NULL, NULL, NULL); select * from masking; x a y -hello XXXXX hello -NULL XXXXX hello +hello YYYYY hello +NULL YYYYY hello hello NULL hello -hello XXXXX NULL +hello YYYYY NULL NULL NULL hello hello NULL NULL NULL NULL NULL @@ -47,11 +47,11 @@ insert into masking values ("hello", NULL, NULL); insert into masking values (NULL, NULL, NULL); select * from masking; x y a -hello hello XXXXX -NULL hello XXXXX -hello NULL XXXXX +hello hello YYYYY +NULL hello YYYYY +hello NULL YYYYY hello hello NULL -NULL NULL XXXXX +NULL NULL YYYYY hello NULL NULL NULL NULL NULL drop table masking; diff --git a/maxscale-system-test/masking/masking_mysqltest/r/masking_replace.result b/maxscale-system-test/masking/masking_mysqltest/r/masking_replace.result index afbd3a9dd..0fca68826 100644 --- a/maxscale-system-test/masking/masking_mysqltest/r/masking_replace.result +++ b/maxscale-system-test/masking/masking_mysqltest/r/masking_replace.result @@ -5,15 +5,15 @@ create table masking (a TEXT, b TEXT, c TEXT); insert into masking values ("blah", "012345-ABC", "012345-ABC"); select * from masking; a b c -XXXX 012345-ABC XXXXXXXXXX +YYYY XXXXXXXXXX YYYYYYYYYY delete from masking; insert into masking values ("blahblah", "221073-01AB", "012345-ABC"); select * from masking; a b c -XXXXXXXX 012345-ABCD XXXXXXXXXX +YYYYYYYY 012345-ABCD YYYYYYYYYY delete from masking; insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB"); select * from masking; a b c -XXXXXXXXXXX 012345-ABCD 012345-ABCD +YYYYYYYYYYY 012345-ABCD 012345-ABCD delete from masking; diff --git a/maxscale-system-test/masking/masking_mysqltest/r/masking_smoke.result b/maxscale-system-test/masking/masking_mysqltest/r/masking_smoke.result index ae84e1d18..6a454fe21 100644 --- a/maxscale-system-test/masking/masking_mysqltest/r/masking_smoke.result +++ b/maxscale-system-test/masking/masking_mysqltest/r/masking_smoke.result @@ -31,46 +31,46 @@ insert into masking_ENUM values ("aaa"); insert into masking_SET values ("aaa"); select * from masking_BINARY; a -XXX +YYY select * from masking_VARBINARY; a -XXX +YYY select * from masking_CHAR; a -XXX +YYY select * from masking_VARCHAR; a -XXX +YYY select * from masking_BLOB; a -XXX +YYY select * from masking_TINYBLOB; a -XXX +YYY select * from masking_MEDIUMBLOB; a -XXX +YYY select * from masking_LONGBLOB; a -XXX +YYY select * from masking_TEXT; a -XXX +YYY select * from masking_TINYTEXT; a -XXX +YYY select * from masking_MEDIUMTEXT; a -XXX +YYY select * from masking_LONGTEXT; a -XXX +YYY select * from masking_ENUM; a -XXX +YYY select * from masking_SET; a -XXX +YYY create table masking_INT (a INT); create table masking_REAL (a REAL(3, 2)); create table masking_DECIMAL (a DECIMAL(3, 2)); diff --git a/maxscale-system-test/masking/masking_mysqltest/t/masking_replace.test b/maxscale-system-test/masking/masking_mysqltest/t/masking_replace.test index e95534f53..331ecc37f 100644 --- a/maxscale-system-test/masking/masking_mysqltest/t/masking_replace.test +++ b/maxscale-system-test/masking/masking_mysqltest/t/masking_replace.test @@ -10,7 +10,7 @@ # "column": "a" # }, # "with": { -# "fill": "X" +# "fill": "Y" # } # }, # { @@ -27,7 +27,7 @@ # }, # "with": { # "value": "012345-ABCD", -# "fill": "X" +# "fill": "Y" # } # } # ] @@ -46,38 +46,38 @@ use maskingdb; # create table masking (a TEXT, b TEXT, c TEXT); -# - a should be just "X...", -# - b should be unchanged as the length does not match the string of "value", and -# there is no catch all "fill". -# - c should be just "X..." as the length does not match, so "value" is not applied +# - a should be just "Y...", +# - b should be changed into "X..." as the length does not match and there is no +# specific fill value, so the default "X" is used. +# - c should be just "Y..." as the length does not match, so "value" is not applied # and has "fill", which is applied. # #a b c -#XXXX 012345-ABC XXXXXXXXXX +#YYYY XXXXXXXXXX YYYYYYYYYY insert into masking values ("blah", "012345-ABC", "012345-ABC"); select * from masking; delete from masking; -# - a should be just "X...", +# - a should be just "Y...", # - b should be changed as the length matches the length of the string of "value" -# - c should be just "X..." as the length does not match, so "value" is not applied +# - c should be just "Y..." as the length does not match, so "value" is not applied # and has "fill", which is applied. # #a b c -#XXXXXXXX 012345-ABCD XXXXXXXXXX +#YYYYYYYY 012345-ABCD YYYYYYYYYY insert into masking values ("blahblah", "221073-01AB", "012345-ABC"); select * from masking; delete from masking; -# - a should be just "X...", +# - a should be just "Y...", # - b should be changed as the length matches the length of the string of "value" # - c should be chanched into a specific string as the length matches the string of # "value" # #a b c #a b c -#XXXXXXXXXXX 012345-ABCD 012345-ABCD -# a should still be just "X", b should be "012345-ABCD" and c should be "012345-ABCD" +#YYYYYYYYYYY 012345-ABCD 012345-ABCD +# a should still be just "Y", b should be "012345-ABCD" and c should be "012345-ABCD" insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB"); select * from masking; delete from masking;