Add tests from develop

Added tests from develop. The test results need to be modified for 2.0.
This commit is contained in:
Markus Mäkelä
2017-05-26 15:40:40 +03:00
parent ad109408b5
commit d7d4ec29bb
596 changed files with 48543 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Note that if modifications are made to any of the t/*-files and the r/*-files
are regenerated, the output MUST BE CHECKED MANUALLY to ensure that the produced
result indeed is the expected. Otherwise the mysqltest-based tests effectively
tests nothing.

View File

@ -0,0 +1,29 @@
{
"rules": [
{
"replace": {
"column": "a"
},
"with": {
"fill": "X"
}
},
{
"replace": {
"column": "b"
},
"with": {
"value": "012345-ABCD"
}
},
{
"replace": {
"column": "c"
},
"with": {
"value": "012345-ABCD",
"fill": "X"
}
}
]
}

View File

@ -0,0 +1,57 @@
drop database if exists maskingdb;
create database maskingdb;
use maskingdb;
create table masking (a TEXT, x TEXT, y TEXT);
insert into masking values ("hello", "hello", "hello");
insert into masking values (NULL, "hello", "hello");
insert into masking values ("hello", NULL, "hello");
insert into masking values ("hello", "hello", NULL);
insert into masking values (NULL, NULL, "hello");
insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL);
select * from masking;
a x y
XXXXX hello hello
NULL hello hello
XXXXX NULL hello
XXXXX hello NULL
NULL NULL hello
XXXXX NULL NULL
NULL NULL NULL
drop table masking;
create table masking (x TEXT, a TEXT, y TEXT);
insert into masking values ("hello", "hello", "hello");
insert into masking values (NULL, "hello", "hello");
insert into masking values ("hello", NULL, "hello");
insert into masking values ("hello", "hello", NULL);
insert into masking values (NULL, NULL, "hello");
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 NULL hello
hello XXXXX NULL
NULL NULL hello
hello NULL NULL
NULL NULL NULL
drop table masking;
create table masking (x TEXT, y TEXT, a TEXT);
insert into masking values ("hello", "hello", "hello");
insert into masking values (NULL, "hello", "hello");
insert into masking values ("hello", NULL, "hello");
insert into masking values ("hello", "hello", NULL);
insert into masking values (NULL, NULL, "hello");
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 NULL
NULL NULL XXXXX
hello NULL NULL
NULL NULL NULL
drop table masking;

View File

@ -0,0 +1,19 @@
drop database if exists maskingdb;
create database maskingdb;
use maskingdb;
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
delete from masking;
insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
select * from masking;
a b c
XXXXXXXX 012345-ABCD XXXXXXXXXX
delete from masking;
insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB");
select * from masking;
a b c
XXXXXXXXXXX 012345-ABCD 012345-ABCD
delete from masking;

View File

@ -0,0 +1,123 @@
drop database if exists maskingdb;
create database maskingdb;
use maskingdb;
create table masking_BINARY (a BINARY(3));
create table masking_VARBINARY (a VARBINARY(8));
create table masking_CHAR (a CHAR(3));
create table masking_VARCHAR (a VARCHAR(13));
create table masking_BLOB (a BLOB);
create table masking_TINYBLOB (a TINYBLOB);
create table masking_MEDIUMBLOB (a MEDIUMBLOB);
create table masking_LONGBLOB (a LONGBLOB);
create table masking_TEXT (a TEXT);
create table masking_TINYTEXT (a TINYTEXT);
create table masking_MEDIUMTEXT (a MEDIUMTEXT);
create table masking_LONGTEXT (a LONGTEXT);
create table masking_ENUM (a ENUM('aaa', 'bbb', 'ccc'));
create table masking_SET (a SET('aaa', 'bbb', 'ccc'));
insert into masking_BINARY values ("aaa");
insert into masking_VARBINARY values ("aaa");
insert into masking_CHAR values ("aaa");
insert into masking_VARCHAR values ("aaa");
insert into masking_BLOB values ("aaa");
insert into masking_TINYBLOB values ("aaa");
insert into masking_MEDIUMBLOB values ("aaa");
insert into masking_LONGBLOB values ("aaa");
insert into masking_TEXT values ("aaa");
insert into masking_TINYTEXT values ("aaa");
insert into masking_MEDIUMTEXT values ("aaa");
insert into masking_LONGTEXT values ("aaa");
insert into masking_ENUM values ("aaa");
insert into masking_SET values ("aaa");
select * from masking_BINARY;
a
XXX
select * from masking_VARBINARY;
a
XXX
select * from masking_CHAR;
a
XXX
select * from masking_VARCHAR;
a
XXX
select * from masking_BLOB;
a
XXX
select * from masking_TINYBLOB;
a
XXX
select * from masking_MEDIUMBLOB;
a
XXX
select * from masking_LONGBLOB;
a
XXX
select * from masking_TEXT;
a
XXX
select * from masking_TINYTEXT;
a
XXX
select * from masking_MEDIUMTEXT;
a
XXX
select * from masking_LONGTEXT;
a
XXX
select * from masking_ENUM;
a
XXX
select * from masking_SET;
a
XXX
create table masking_INT (a INT);
create table masking_REAL (a REAL(3, 2));
create table masking_DECIMAL (a DECIMAL(3, 2));
create table masking_FLOAT (a FLOAT(3, 2));
create table masking_DOUBLE (a DOUBLE(3, 2));
create table masking_DATE (a DATE);
create table masking_TIME (a TIME);
create table masking_DATETIME (a DATETIME);
create table masking_TIMESTAMP (a TIMESTAMP);
create table masking_YEAR (a YEAR);
insert into masking_INT values (4711);
insert into masking_REAL values (3.14);
insert into masking_DECIMAL values (3.14);
insert into masking_FLOAT values (3.14);
insert into masking_DOUBLE values (3.14);
insert into masking_DATE values ('2017-01-24');
insert into masking_TIME values ('13:52:21');
insert into masking_DATETIME values ('2017-01-24 13:52:21');
insert into masking_TIMESTAMP values ('2017-01-24 13:52:21');
insert into masking_YEAR values ('2001');
select * from masking_INT;
a
4711
select * from masking_REAL;
a
3.14
select * from masking_DECIMAL;
a
3.14
select * from masking_FLOAT;
a
3.14
select * from masking_DOUBLE;
a
3.14
select * from masking_DATE;
a
2017-01-24
select * from masking_TIME;
a
13:52:21
select * from masking_DATETIME;
a
2017-01-24 13:52:21
select * from masking_TIMESTAMP;
a
2017-01-24 13:52:21
select * from masking_YEAR;
a
2001

View File

@ -0,0 +1,75 @@
#
# Masking column handling
#
# Whether the column to be masked is first, in the middle or
# last should not matter.
#
# See ../masking_rules.json
--disable_warnings
drop database if exists maskingdb;
--enable_warnings
create database maskingdb;
use maskingdb;
create table masking (a TEXT, x TEXT, y TEXT);
insert into masking values ("hello", "hello", "hello");
insert into masking values (NULL, "hello", "hello");
insert into masking values ("hello", NULL, "hello");
insert into masking values ("hello", "hello", NULL);
insert into masking values (NULL, NULL, "hello");
insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL);
select * from masking;
#a x y
#XXXXX hello hello
#NULL hello hello
#XXXXX NULL hello
#XXXXX hello NULL
#NULL NULL hello
#XXXXX NULL NULL
#NULL NULL NULL
drop table masking;
create table masking (x TEXT, a TEXT, y TEXT);
insert into masking values ("hello", "hello", "hello");
insert into masking values (NULL, "hello", "hello");
insert into masking values ("hello", NULL, "hello");
insert into masking values ("hello", "hello", NULL);
insert into masking values (NULL, NULL, "hello");
insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL);
select * from masking;
#x a y
#hello XXXXX hello
#hello XXXXX hello
#NULL XXXXX hello
#hello NULL hello
#hello XXXXX NULL
#NULL NULL hello
#hello NULL NULL
#NULL NULL NULL
drop table masking;
create table masking (x TEXT, y TEXT, a TEXT);
insert into masking values ("hello", "hello", "hello");
insert into masking values (NULL, "hello", "hello");
insert into masking values ("hello", NULL, "hello");
insert into masking values ("hello", "hello", NULL);
insert into masking values (NULL, NULL, "hello");
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 NULL
#NULL NULL XXXXX
#hello NULL NULL
#NULL NULL NULL
drop table masking;

View File

@ -0,0 +1,83 @@
#
# Masking Smoke
#
# We expect the masking rules to be as follows:
#
# {
# "rules": [
# {
# "replace": {
# "column": "a"
# },
# "with": {
# "fill": "X"
# }
# },
# {
# "replace": {
# "column": "b"
# },
# "with": {
# "value": "012345-ABCD"
# }
# },
# {
# "replace": {
# "column": "c"
# },
# "with": {
# "value": "012345-ABCD",
# "fill": "X"
# }
# }
# ]
# }
--disable_warnings
drop database if exists maskingdb;
--enable_warnings
create database maskingdb;
use maskingdb;
#
# Each table contains a single column 'a' of a type subject
# to masking.
#
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
# and has "fill", which is applied.
#
#a b c
#XXXX 012345-ABC XXXXXXXXXX
insert into masking values ("blah", "012345-ABC", "012345-ABC");
select * from masking;
delete from masking;
# - a should be just "X...",
# - 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
# and has "fill", which is applied.
#
#a b c
#XXXXXXXX 012345-ABCD XXXXXXXXXX
insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
select * from masking;
delete from masking;
# - a should be just "X...",
# - 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"
insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB");
select * from masking;
delete from masking;

View File

@ -0,0 +1,126 @@
#
# Masking Smoke
#
# We expect the masking rules to be as follows:
#
# {
# "rules": [
# {
# "replace": {
# "column": "a"
# },
# "with": {
# "fill": "X"
# }
# }
# ]
# }
--disable_warnings
drop database if exists maskingdb;
--enable_warnings
create database maskingdb;
use maskingdb;
#
# Each table contains a single column 'a' of a type subject
# to masking.
#
create table masking_BINARY (a BINARY(3));
create table masking_VARBINARY (a VARBINARY(8));
create table masking_CHAR (a CHAR(3));
create table masking_VARCHAR (a VARCHAR(13));
create table masking_BLOB (a BLOB);
create table masking_TINYBLOB (a TINYBLOB);
create table masking_MEDIUMBLOB (a MEDIUMBLOB);
create table masking_LONGBLOB (a LONGBLOB);
create table masking_TEXT (a TEXT);
create table masking_TINYTEXT (a TINYTEXT);
create table masking_MEDIUMTEXT (a MEDIUMTEXT);
create table masking_LONGTEXT (a LONGTEXT);
create table masking_ENUM (a ENUM('aaa', 'bbb', 'ccc'));
create table masking_SET (a SET('aaa', 'bbb', 'ccc'));
insert into masking_BINARY values ("aaa");
insert into masking_VARBINARY values ("aaa");
insert into masking_CHAR values ("aaa");
insert into masking_VARCHAR values ("aaa");
insert into masking_BLOB values ("aaa");
insert into masking_TINYBLOB values ("aaa");
insert into masking_MEDIUMBLOB values ("aaa");
insert into masking_LONGBLOB values ("aaa");
insert into masking_TEXT values ("aaa");
insert into masking_TINYTEXT values ("aaa");
insert into masking_MEDIUMTEXT values ("aaa");
insert into masking_LONGTEXT values ("aaa");
insert into masking_ENUM values ("aaa");
insert into masking_SET values ("aaa");
#
# In masking_smoke.result, we should have:
#
# a
# XXX
#
# for each following select.
#
select * from masking_BINARY;
select * from masking_VARBINARY;
select * from masking_CHAR;
select * from masking_VARCHAR;
select * from masking_BLOB;
select * from masking_TINYBLOB;
select * from masking_MEDIUMBLOB;
select * from masking_LONGBLOB;
select * from masking_TEXT;
select * from masking_TINYTEXT;
select * from masking_MEDIUMTEXT;
select * from masking_LONGTEXT;
select * from masking_ENUM;
select * from masking_SET;
#
# Each table contains a single column 'a' of a type NOT subject
# to masking.
#
create table masking_INT (a INT);
create table masking_REAL (a REAL(3, 2));
create table masking_DECIMAL (a DECIMAL(3, 2));
create table masking_FLOAT (a FLOAT(3, 2));
create table masking_DOUBLE (a DOUBLE(3, 2));
create table masking_DATE (a DATE);
create table masking_TIME (a TIME);
create table masking_DATETIME (a DATETIME);
create table masking_TIMESTAMP (a TIMESTAMP);
create table masking_YEAR (a YEAR);
insert into masking_INT values (4711);
insert into masking_REAL values (3.14);
insert into masking_DECIMAL values (3.14);
insert into masking_FLOAT values (3.14);
insert into masking_DOUBLE values (3.14);
insert into masking_DATE values ('2017-01-24');
insert into masking_TIME values ('13:52:21');
insert into masking_DATETIME values ('2017-01-24 13:52:21');
insert into masking_TIMESTAMP values ('2017-01-24 13:52:21');
insert into masking_YEAR values ('2001');
#
# In masking_smoke.result, we should have:
#
# a
# <whatever-we-put-there>
#
# for each following select.
#
select * from masking_INT;
select * from masking_REAL;
select * from masking_DECIMAL;
select * from masking_FLOAT;
select * from masking_DOUBLE;
select * from masking_DATE;
select * from masking_TIME;
select * from masking_DATETIME;
select * from masking_TIMESTAMP;
select * from masking_YEAR;

View File

@ -0,0 +1,76 @@
{
"rules": [
{
"replace": {
"column": "a"
},
"with": {
"fill": "X"
}
},
{
"replace": {
"column": "b"
},
"with": {
"fill": "X"
},
"applies_to" : [ "'skysql'" ]
},
{
"replace": {
"column": "c"
},
"with": {
"fill": "X"
},
"applies_to" : [ "'maxskysql'" ]
},
{
"replace": {
"column": "d"
},
"with": {
"fill": "X"
},
"exempted" : [ "'skysql'" ]
},
{
"replace": {
"column": "e"
},
"with": {
"fill": "X"
},
"exempted" : [ "'maxskysql'" ]
},
{
"replace": {
"column": "f"
},
"with": {
"fill": "X"
},
"applies_to" : [ "'skysql'", "'maxskysql'" ]
},
{
"replace": {
"column": "g"
},
"with": {
"fill": "X"
},
"exempted" : [ "'skysql'", "'maxskysql'" ]
},
{
"replace": {
"column": "h"
},
"with": {
"fill": "X"
},
"applies_to" : [ "'skysql'" ],
"exempted" : [ "'maxskysql'" ]
}
]
}

View File

@ -0,0 +1,8 @@
drop database if exists maskingdb;
create database maskingdb;
use maskingdb;
create table masking (a TEXT, b TEXT, c TEXT, d TEXT, e TEXT, f TEXT, g TEXT, h TEXT);
insert into masking values ("hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello");
select * from masking;
a b c d e f g h
XXXXX hello XXXXX XXXXX hello XXXXX hello hello

View File

@ -0,0 +1,8 @@
drop database if exists maskingdb;
create database maskingdb;
use maskingdb;
create table masking (a TEXT, b TEXT, c TEXT, d TEXT, e TEXT, f TEXT, g TEXT, h TEXT);
insert into masking values ("hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello");
select * from masking;
a b c d e f g h
XXXXX XXXXX hello hello XXXXX XXXXX hello XXXXX

View File

@ -0,0 +1,46 @@
#
# Masking User
#
# See ../masking_rules.json
drop database if exists maskingdb;
create database maskingdb;
use maskingdb;
#
# Each table contains a single column 'a' of a type subject
# to masking.
#
create table masking (a TEXT, b TEXT, c TEXT, d TEXT, e TEXT, f TEXT, g TEXT, h TEXT);
insert into masking values ("hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello");
select * from masking;
# With the user skysql
#
# a: XXXXX, because the rule applies to everyone.
# b: XXXXX, because the rule specifically applies to the user 'skysql'
# c: hello, because the rule specifically applies to the user 'maxskysql'
# d: hello, because the rule specifically excludes the user 'skysql'
# e: XXXXX, because the rule applies to everyone except to the user 'maxskysql'
# f: XXXXX, because the rule applies to the user 'skysql' and 'maxskysql'
# g: hello, because the rule specifically does not apply to the users 'skysql' and 'maxskysql'
# h: XXXXX, because the rule specifically applies to the user 'skysql'
#
#a b c d e f g h
#XXXXX XXXXX hello hello XXXXX XXXXX hello XXXXX
# With the user maxskysql
#
# a: XXXXX, because the rule applies to everyone.
# b: hello, because the rule specifically applies to the user 'skysql'
# c: XXXXX, because the rule specifically applies to the user 'maxskysql'
# d: XXXXX, because the rule specifically excludes the user 'skysql'
# e: hello, because the rule applies to everyone except to the user 'maxskysql'
# f: XXXXX, because the rule applies to the user 'skysql' and 'maxskysql'
# g: hello, because the rule specifically does not apply to the users 'skysql' and 'maxskysql'
# h: XXXXX, because the rule specifically applies to the user 'skysql'
#
#a b c d e f g h
#XXXXX hello XXXXX XXXXX hello XXXXX hello hello