
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.
84 lines
2.1 KiB
Plaintext
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;
|