Files
MaxScale/maxscale-system-test/masking/masking_mysqltest/t/masking_replace.test
Markus Mäkelä d7d4ec29bb Add tests from develop
Added tests from develop. The test results need to be modified for 2.0.
2017-05-26 15:40:40 +03:00

84 lines
2.1 KiB
Plaintext

#
# 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;