Skip to content

Commit 2f11e1f

Browse files
PiyushGufacebook-github-bot
authored andcommitted
Updating Data Endorsement Test with new checks and Result
Summary: Updating Data Endorsement Test with new checks and Result as now we will have Privacy Policy Check result Differential Revision: D46392670 fbshipit-source-id: c7a027b
1 parent e8dc455 commit 2f11e1f

File tree

2 files changed

+58
-68
lines changed

2 files changed

+58
-68
lines changed

mysql-test/suite/privacy/r/privacy_plugin_dep.result

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ set @original_privacy_plugin_purpose_policy_check=@@session.privacy_plugin_purpo
1212
set @original_privacy_plugin_dep_check=@@session.privacy_plugin_dep_check;
1313
set @original_privacy_plugin_response_attrs_contain_pp_status=@@session.privacy_plugin_response_attrs_contain_policy_status;
1414
set @original_privacy_plugin_response_attrs_contain_dep_status=@@session.privacy_plugin_response_attrs_contain_dep_status;
15+
set @original_privacy_plugin_is_pxl_enabled=@@session.privacy_plugin_pxl_policy_flow_enabled;
1516
set session privacy_plugin_response_attrs_contain_dep_status=on;
1617
set session privacy_plugin_response_attrs_contain_policy_status=on;
18+
set session privacy_plugin_pxl_policy_flow_enabled=on;
1719
set global privacy_plugin_on = 1;
1820
set session privacy_plugin_purpose_policy_check=off;
1921
set session privacy_plugin_dep_check=off;
2022
# Test 1: Plugin enabled and both policy check is disabled, we should do evaluations and get the results
2123
select * from privacy_blood_donation_table;
2224
id name
2325
1 User1
24-
ResultWhenEnabledAndDepOff: SKIPPED
25-
ReasonWhenEnabledAndDepOff: Endorsement policy check off
26+
PrivacyResultWhenEnabledAndDepOff: {"result":{"2":{"checkResult":"SKIPPED","reason":"Endorsement policy check off"},"1":{"checkResult":"SKIPPED","reason":"Purpose policy check off"}}}
2627
ResultWhenEnabledAndPurposePolicyOff: SKIPPED
2728
ReasonWhenEnabledAndPurposePolicyOff: Purpose policy check off
2829
select 23;
2930
23
3031
23
31-
ResultWhenNoTablesAndDepOff: SKIPPED
32-
ReasonWhenNoTablesAndDepOff: Endorsement policy check off
32+
PrivacyResultWhenNoTablesAndDepOff: {"result":{"2":{"checkResult":"SKIPPED","reason":"Endorsement policy check off"},"1":{"checkResult":"SKIPPED","reason":"Purpose policy check off"}}}
3333
ResultWhenNoTablesAndPurposePolicyOff: SKIPPED
3434
ReasonWhenNoTablesAndPurposePolicyOff: Purpose policy check off
3535
# Test 2: Plugin disabled and we shouldn't do evaluations and result would be missing
@@ -39,15 +39,13 @@ set session privacy_plugin_dep_check=fail_open;
3939
select * from privacy_blood_donation_table;
4040
id name
4141
1 User1
42-
ResultWhenDisabledAndDepOn: SKIPPED
43-
ReasonWhenDisabledAndDepOn:
42+
PrivacyResultWhenDisabledAndDepOn: {"result":{"2":{"checkResult":"SKIPPED","reason":""},"1":{"checkResult":"SKIPPED","reason":""}}}
4443
ResultWhenDisabledAndPurposePolicyOn: SKIPPED
4544
ReasonWhenDisabledAndPurposePolicyOn:
4645
select 23;
4746
23
4847
23
49-
ResultWhenNoTablesAndPluginDisabled: SKIPPED
50-
ReasonWhenNoTablesAndPluginDisabled:
48+
PrivacyResultWhenNoTablesAndPluginDisabled: {"result":{"2":{"checkResult":"SKIPPED","reason":""},"1":{"checkResult":"SKIPPED","reason":""}}}
5149
ResultWhenNoTablesAndPluginDisabled: SKIPPED
5250
ReasonWhenNoTablesAndPluginDisabled:
5351
# Test 3: Plugin enabled, Endorsement Off, Purpose Policy On
@@ -57,43 +55,52 @@ set session privacy_plugin_dep_check=off;
5755
select * from privacy_blood_donation_table;
5856
id name
5957
1 User1
60-
ResultWhenEnabledAndDepOff: SKIPPED
61-
ReasonWhenEnabledAndDepOff: Endorsement policy check off
58+
PrivacyResultWhenEnabledAndDepOff: {"result":{"1":{"checkResult":"PASS","reason":"Purpose FlowsTo result","policy":"fbig::consumer_products::core_products::blood_donation and pxl_ref(\"purpose_policies/blood_donor\")","enforcementMode":"FAIL_OPEN"},"2":{"checkResult":"SKIPPED","reason":"Endorsement policy check off"}}}
6259
ResultWhenEnabledAndPurposePolicyOn: PASS
63-
ReasonWhenEnabledAndPurposePolicyOn: FlowsTo result
60+
ReasonWhenEnabledAndPurposePolicyOn: Purpose FlowsTo result
6461
select 23;
6562
23
6663
23
67-
ResultWhenNoTablesAndDepOff: SKIPPED
68-
ReasonWhenNoTablesAndDepOff: Endorsement policy check off
64+
PrivacyResultWhenNoTablesAndDepOff: {"result":{"1":{"checkResult":"PASS","reason":"No non-user tables found"},"2":{"checkResult":"SKIPPED","reason":"Endorsement policy check off"}}}
6965
ResultWhenNoTablesAndPurposePolicyOn: PASS
7066
ReasonWhenNoTablesAndPurposePolicyOn: No non-user tables found
7167
# Test 4: Plugin enabled, Endorsement On, Purpose Policy Off
7268
set global privacy_plugin_on = 1;
7369
set session privacy_plugin_purpose_policy_check=off;
7470
set session privacy_plugin_dep_check=fail_open;
71+
select * from privacy_blood_donation_table;
72+
id name
73+
1 User1
74+
PrivacyResultWhenEnabledAndDepOn: {"result":{"2":{"checkResult":"PASS","reason":"Endorsement FlowsTo result","policy":"pxl_ref(\"endorsement/ads_curated\")","enforcementMode":"FAIL_OPEN"},"1":{"checkResult":"SKIPPED","reason":"Purpose policy check off"}}}
75+
ResultWhenEnabledAndPurposePolicyOn: SKIPPED
76+
ReasonWhenEnabledAndPurposePolicyOn: Purpose policy check off
7577
select 23;
7678
23
7779
23
78-
ResultWhenNoTablesAndDepOn: PASS
79-
ReasonWhenNoTablesAndDepOn: No non-user tables found
80+
PrivacyResultWhenNoTablesAndDepOn: {"result":{"2":{"checkResult":"PASS","reason":"No non-user tables found"},"1":{"checkResult":"SKIPPED","reason":"Purpose policy check off"}}}
8081
ResultWhenNoTablesAndPurposePolicyOff: SKIPPED
8182
ReasonWhenNoTablesAndPurposePolicyOff: Purpose policy check off
8283
# Test 5: Plugin enabled, Endorsement On, Purpose Policy On
8384
set global privacy_plugin_on = 1;
8485
set session privacy_plugin_purpose_policy_check=fail_open;
8586
set session privacy_plugin_dep_check=fail_open;
87+
select * from privacy_blood_donation_table;
88+
id name
89+
1 User1
90+
PrivacyResultWhenEnabledAndDepOff: {"result":{"2":{"checkResult":"PASS","reason":"Endorsement FlowsTo result","policy":"pxl_ref(\"endorsement/ads_curated\")","enforcementMode":"FAIL_OPEN"},"1":{"checkResult":"PASS","reason":"Purpose FlowsTo result","policy":"fbig::consumer_products::core_products::blood_donation and pxl_ref(\"purpose_policies/blood_donor\")","enforcementMode":"FAIL_OPEN"}}}
91+
ResultWhenEnabledAndPurposePolicyOn: PASS
92+
ReasonWhenEnabledAndPurposePolicyOn: Purpose FlowsTo result
8693
select 23;
8794
23
8895
23
89-
ResultWhenNoTablesAndDepOn: PASS
90-
ReasonWhenNoTablesAndDepOn: No non-user tables found
96+
PrivacyResultWhenNoTablesAndDepOn: {"result":{"2":{"checkResult":"PASS","reason":"No non-user tables found"},"1":{"checkResult":"PASS","reason":"No non-user tables found"}}}
9197
ResultWhenNoTablesAndPurposePolicyOn: PASS
9298
ReasonWhenNoTablesAndPurposePolicyOn: No non-user tables found
9399
set session privacy_plugin_purpose_policy_check=@original_privacy_plugin_purpose_policy_check;
94100
set session privacy_plugin_dep_check=@original_privacy_plugin_dep_check;
95101
set session privacy_plugin_response_attrs_contain_policy_status=@original_privacy_plugin_response_attrs_contain_pp_status;
96102
set session privacy_plugin_response_attrs_contain_dep_status=@original_privacy_plugin_response_attrs_contain_dep_status;
103+
set session privacy_plugin_pxl_policy_flow_enabled=@original_privacy_plugin_is_pxl_enabled;
97104
drop table privacy_blood_donation_table;
98105
set session session_track_response_attributes=@original_session_track_response_attributes;
99106
set global privacy_plugin_on=@original_privacy_plugin_on;

mysql-test/suite/privacy/t/privacy_plugin_dep.test

Lines changed: 34 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ set @original_privacy_plugin_purpose_policy_check=@@session.privacy_plugin_purpo
1111
set @original_privacy_plugin_dep_check=@@session.privacy_plugin_dep_check;
1212
set @original_privacy_plugin_response_attrs_contain_pp_status=@@session.privacy_plugin_response_attrs_contain_policy_status;
1313
set @original_privacy_plugin_response_attrs_contain_dep_status=@@session.privacy_plugin_response_attrs_contain_dep_status;
14+
set @original_privacy_plugin_is_pxl_enabled=@@session.privacy_plugin_pxl_policy_flow_enabled;
1415

1516
set session privacy_plugin_response_attrs_contain_dep_status=on;
1617
set session privacy_plugin_response_attrs_contain_policy_status=on;
18+
set session privacy_plugin_pxl_policy_flow_enabled=on;
1719

1820
query_attrs_add shard xdb.dbclient_test.1;
19-
query_attrs_add cipp_context {"policySet":{"purposePolicyInstance":{"purposePolicy":{"policyName":"blood_donor","version":1,"schemaVersion":1},"cippEnforcementMode":1,"wasToken":false,"inEnforcementMode":1,"outEnforcementMode":1},"casdPolicyInstance":{"casdPolicy":{"policyName":"public_data"},"cippEnforcementMode":1},"endorsementPolicyInstance":{"cippEnforcementMode":1,"name":"blood_donor_dep"},"wasToken":false}};
21+
query_attrs_add cipp_context {"policySet":{"purposePolicyInstance":{"purposePolicy":{"policyName":"blood_donor","version":1,"schemaVersion":1},"cippEnforcementMode":1,"wasToken":false,"inEnforcementMode":1,"outEnforcementMode":1},"casdPolicyInstance":{"casdPolicy":{"policyName":"public_data"},"cippEnforcementMode":1},"endorsementPolicyInstance":{"cippEnforcementMode":1,"name":"ads_contracted"},"wasToken":false}};
2022

2123

2224
# When sending response is enabled and both policy check is disabled, attribute should set to skip for query
@@ -26,24 +28,20 @@ set session privacy_plugin_dep_check=off;
2628

2729
--echo # Test 1: Plugin enabled and both policy check is disabled, we should do evaluations and get the results
2830
select * from privacy_blood_donation_table;
29-
let $dep_result = get_response_attribute(dep_check_result);
30-
let $dep_result_reason = get_response_attribute(dep_check_result_reason);
31+
let $privacy_result = get_response_attribute(privacy_policy_result);
3132
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
3233
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
3334

34-
--echo ResultWhenEnabledAndDepOff: $dep_result
35-
--echo ReasonWhenEnabledAndDepOff: $dep_result_reason
35+
--echo PrivacyResultWhenEnabledAndDepOff: $privacy_result
3636
--echo ResultWhenEnabledAndPurposePolicyOff: $purpose_policy_result
3737
--echo ReasonWhenEnabledAndPurposePolicyOff: $purpose_policy_result_reason
3838

3939
select 23;
40-
let $dep_result = get_response_attribute(dep_check_result);
41-
let $dep_result_reason = get_response_attribute(dep_check_result_reason);
40+
let $privacy_result = get_response_attribute(privacy_policy_result);
4241
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
4342
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
4443

45-
--echo ResultWhenNoTablesAndDepOff: $dep_result
46-
--echo ReasonWhenNoTablesAndDepOff: $dep_result_reason
44+
--echo PrivacyResultWhenNoTablesAndDepOff: $privacy_result
4745
--echo ResultWhenNoTablesAndPurposePolicyOff: $purpose_policy_result
4846
--echo ReasonWhenNoTablesAndPurposePolicyOff: $purpose_policy_result_reason
4947

@@ -55,24 +53,20 @@ set session privacy_plugin_purpose_policy_check=fail_open;
5553
set session privacy_plugin_dep_check=fail_open;
5654

5755
select * from privacy_blood_donation_table;
58-
let $dep_result = get_response_attribute(dep_check_result);
59-
let $dep_result_reason = get_response_attribute(dep_check_result_reason);
56+
let $privacy_result = get_response_attribute(privacy_policy_result);
6057
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
6158
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
6259

63-
--echo ResultWhenDisabledAndDepOn: $dep_result
64-
--echo ReasonWhenDisabledAndDepOn: $dep_result_reason
60+
--echo PrivacyResultWhenDisabledAndDepOn: $privacy_result
6561
--echo ResultWhenDisabledAndPurposePolicyOn: $purpose_policy_result
6662
--echo ReasonWhenDisabledAndPurposePolicyOn: $purpose_policy_result_reason
6763

6864
select 23;
69-
let $dep_result = get_response_attribute(dep_check_result);
70-
let $dep_result_reason = get_response_attribute(dep_check_result_reason);
65+
let $privacy_result = get_response_attribute(privacy_policy_result);
7166
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
7267
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
7368

74-
--echo ResultWhenNoTablesAndPluginDisabled: $dep_result
75-
--echo ReasonWhenNoTablesAndPluginDisabled: $dep_result_reason
69+
--echo PrivacyResultWhenNoTablesAndPluginDisabled: $privacy_result
7670
--echo ResultWhenNoTablesAndPluginDisabled: $purpose_policy_result
7771
--echo ReasonWhenNoTablesAndPluginDisabled: $purpose_policy_result_reason
7872

@@ -84,24 +78,20 @@ set session privacy_plugin_purpose_policy_check=fail_open;
8478
set session privacy_plugin_dep_check=off;
8579

8680
select * from privacy_blood_donation_table;
87-
let $dep_result = get_response_attribute(dep_check_result);
88-
let $dep_result_reason = get_response_attribute(dep_check_result_reason);
81+
let $privacy_result = get_response_attribute(privacy_policy_result);
8982
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
9083
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
9184

92-
--echo ResultWhenEnabledAndDepOff: $dep_result
93-
--echo ReasonWhenEnabledAndDepOff: $dep_result_reason
85+
--echo PrivacyResultWhenEnabledAndDepOff: $privacy_result
9486
--echo ResultWhenEnabledAndPurposePolicyOn: $purpose_policy_result
9587
--echo ReasonWhenEnabledAndPurposePolicyOn: $purpose_policy_result_reason
9688

9789
select 23;
98-
let $dep_result = get_response_attribute(dep_check_result);
99-
let $dep_result_reason = get_response_attribute(dep_check_result_reason);
90+
let $privacy_result = get_response_attribute(privacy_policy_result);
10091
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
10192
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
10293

103-
--echo ResultWhenNoTablesAndDepOff: $dep_result
104-
--echo ReasonWhenNoTablesAndDepOff: $dep_result_reason
94+
--echo PrivacyResultWhenNoTablesAndDepOff: $privacy_result
10595
--echo ResultWhenNoTablesAndPurposePolicyOn: $purpose_policy_result
10696
--echo ReasonWhenNoTablesAndPurposePolicyOn: $purpose_policy_result_reason
10797

@@ -113,24 +103,20 @@ set session privacy_plugin_purpose_policy_check=off;
113103
set session privacy_plugin_dep_check=fail_open;
114104

115105
# Will remove the comment block once the Plugin start doing flow to check for endorsement policy
116-
# select * from privacy_blood_donation_table;
117-
# let $dep_result = get_response_attribute(dep_check_result);
118-
# let $dep_result_reason = get_response_attribute(dep_check_result_reason);
119-
# let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
120-
# let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
121-
# --echo ResultWhenEnabledAndDepOff: $dep_result
122-
# --echo ReasonWhenEnabledAndDepOff: $dep_result_reason
123-
# --echo ResultWhenEnabledAndPurposePolicyOn: $purpose_policy_result
124-
# --echo ReasonWhenEnabledAndPurposePolicyOn: $purpose_policy_result_reason
106+
select * from privacy_blood_donation_table;
107+
let $privacy_result = get_response_attribute(privacy_policy_result);
108+
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
109+
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
110+
--echo PrivacyResultWhenEnabledAndDepOn: $privacy_result
111+
--echo ResultWhenEnabledAndPurposePolicyOn: $purpose_policy_result
112+
--echo ReasonWhenEnabledAndPurposePolicyOn: $purpose_policy_result_reason
125113

126114
select 23;
127-
let $dep_result = get_response_attribute(dep_check_result);
128-
let $dep_result_reason = get_response_attribute(dep_check_result_reason);
115+
let $privacy_result = get_response_attribute(privacy_policy_result);
129116
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
130117
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
131118

132-
--echo ResultWhenNoTablesAndDepOn: $dep_result
133-
--echo ReasonWhenNoTablesAndDepOn: $dep_result_reason
119+
--echo PrivacyResultWhenNoTablesAndDepOn: $privacy_result
134120
--echo ResultWhenNoTablesAndPurposePolicyOff: $purpose_policy_result
135121
--echo ReasonWhenNoTablesAndPurposePolicyOff: $purpose_policy_result_reason
136122

@@ -142,24 +128,20 @@ set session privacy_plugin_purpose_policy_check=fail_open;
142128
set session privacy_plugin_dep_check=fail_open;
143129

144130
# Will remove the comment block once the Plugin start doing flow to check for endorsement policy
145-
# select * from privacy_blood_donation_table;
146-
# let $dep_result = get_response_attribute(dep_check_result);
147-
# let $dep_result_reason = get_response_attribute(dep_check_result_reason);
148-
# let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
149-
# let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
150-
# --echo ResultWhenEnabledAndDepOff: $dep_result
151-
# --echo ReasonWhenEnabledAndDepOff: $dep_result_reason
152-
# --echo ResultWhenEnabledAndPurposePolicyOn: $purpose_policy_result
153-
# --echo ReasonWhenEnabledAndPurposePolicyOn: $purpose_policy_result_reason
131+
select * from privacy_blood_donation_table;
132+
let $privacy_result = get_response_attribute(privacy_policy_result);
133+
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
134+
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
135+
--echo PrivacyResultWhenEnabledAndDepOff: $privacy_result
136+
--echo ResultWhenEnabledAndPurposePolicyOn: $purpose_policy_result
137+
--echo ReasonWhenEnabledAndPurposePolicyOn: $purpose_policy_result_reason
154138

155139
select 23;
156-
let $dep_result = get_response_attribute(dep_check_result);
157-
let $dep_result_reason = get_response_attribute(dep_check_result_reason);
140+
let $privacy_result = get_response_attribute(privacy_policy_result);
158141
let $purpose_policy_result = get_response_attribute(purpose_policy_check_result);
159142
let $purpose_policy_result_reason = get_response_attribute(purpose_policy_check_result_reason);
160143

161-
--echo ResultWhenNoTablesAndDepOn: $dep_result
162-
--echo ReasonWhenNoTablesAndDepOn: $dep_result_reason
144+
--echo PrivacyResultWhenNoTablesAndDepOn: $privacy_result
163145
--echo ResultWhenNoTablesAndPurposePolicyOn: $purpose_policy_result
164146
--echo ReasonWhenNoTablesAndPurposePolicyOn: $purpose_policy_result_reason
165147

@@ -170,6 +152,7 @@ set session privacy_plugin_purpose_policy_check=@original_privacy_plugin_purpose
170152
set session privacy_plugin_dep_check=@original_privacy_plugin_dep_check;
171153
set session privacy_plugin_response_attrs_contain_policy_status=@original_privacy_plugin_response_attrs_contain_pp_status;
172154
set session privacy_plugin_response_attrs_contain_dep_status=@original_privacy_plugin_response_attrs_contain_dep_status;
155+
set session privacy_plugin_pxl_policy_flow_enabled=@original_privacy_plugin_is_pxl_enabled;
173156
query_attrs_delete shard;
174157
drop table privacy_blood_donation_table;
175158

0 commit comments

Comments
 (0)