Files
MaxScale/system-test/masking/masking_mysqltest/t/masking_replace.test
Esa Korhonen 08f5174915 MXS-2900 Rename maxscale-system-test directory to system-test
A link with the old directory name is provided.
2020-07-28 15:24:27 +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": "Y"
# }
# },
# {
# "replace": {
# "column": "b"
# },
# "with": {
# "value": "012345-ABCD"
# }
# },
# {
# "replace": {
# "column": "c"
# },
# "with": {
# "value": "012345-ABCD",
# "fill": "Y"
# }
# }
# ]
# }
--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 "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
#YYYY XXXXXXXXXX YYYYYYYYYY
insert into masking values ("blah", "012345-ABC", "012345-ABC");
select * from masking;
delete from masking;
# - a should be just "Y...",
# - b should be changed as the length matches the length of the string of "value"
# - 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
#YYYYYYYY 012345-ABCD YYYYYYYYYY
insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
select * from masking;
delete from masking;
# - 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
#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;