From 53338a93c8f827d862c17d43bab38a2815534980 Mon Sep 17 00:00:00 2001 From: Nikolay Proskurin Date: Tue, 24 Oct 2023 16:43:38 +0200 Subject: [PATCH] BI-4885: add test RLS configs --- .../dl_testing/test_data/rls_configs/bad | 2 + .../test_data/rls_configs/bad_login | 2 + .../test_data/rls_configs/iam_subjects.json | 38 ++++++++++++ .../test_data/rls_configs/missing_login | 4 ++ .../test_data/rls_configs/missing_login.json | 58 +++++++++++++++++++ .../rls_configs/missing_login_to_compare | 3 + .../rls_configs/missing_login_updated | 3 + .../rls_configs/missing_login_updated.json | 58 +++++++++++++++++++ .../dl_testing/test_data/rls_configs/simple | 4 ++ .../test_data/rls_configs/simple.json | 42 ++++++++++++++ .../test_data/rls_configs/simple_to_compare | 3 + .../test_data/rls_configs/simple_updated | 3 + .../test_data/rls_configs/simple_updated.json | 42 ++++++++++++++ .../test_data/rls_configs/wildcards | 7 +++ .../test_data/rls_configs/wildcards.json | 34 +++++++++++ .../rls_configs/wildcards_to_compare | 6 ++ 16 files changed, 309 insertions(+) create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/bad create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/bad_login create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/iam_subjects.json create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/missing_login create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/missing_login.json create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_to_compare create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_updated create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_updated.json create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/simple create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/simple.json create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/simple_to_compare create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/simple_updated create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/simple_updated.json create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/wildcards create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/wildcards.json create mode 100644 lib/dl_testing/dl_testing/test_data/rls_configs/wildcards_to_compare diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/bad b/lib/dl_testing/dl_testing/test_data/rls_configs/bad new file mode 100644 index 000000000..639deb649 --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/bad @@ -0,0 +1,2 @@ +'Москва': user1, user2 +'Самара':user1, user3 diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/bad_login b/lib/dl_testing/dl_testing/test_data/rls_configs/bad_login new file mode 100644 index 000000000..2cc19c64c --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/bad_login @@ -0,0 +1,2 @@ +'Москва': user1, user2 +'Самара': user1, user3, robot-user2 diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/iam_subjects.json b/lib/dl_testing/dl_testing/test_data/rls_configs/iam_subjects.json new file mode 100644 index 000000000..461e1378b --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/iam_subjects.json @@ -0,0 +1,38 @@ +[ + { + "id": "1120000000000529", + "email": "user1@yandex.ru", + "title": "user1", + "subject_type": "USER_ACCOUNT" + }, + { + "id": "1120000000001062", + "email": "user4@yandex.ru", + "title": "user4", + "subject_type": "USER_ACCOUNT" + }, + { + "id": "1120000000000251", + "email": "user5@yandex.ru", + "title": "user5", + "subject_type": "USER_ACCOUNT" + }, + { + "id": "1120000000013893", + "email": "user6@yandex.ru", + "title": "user6", + "subject_type": "USER_ACCOUNT" + }, + { + "id": "1120000000019416", + "email": "user2@yandex.ru", + "title": "user2", + "subject_type": "USER_ACCOUNT" + }, + { + "id": "1120000000001001", + "email": "user3@yandex.ru", + "title": "user3", + "subject_type": "USER_ACCOUNT" + } +] diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login new file mode 100644 index 000000000..a88fec5a4 --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login @@ -0,0 +1,4 @@ +'Москва': user1, user2, robot-user2 +'Самара': user1, user3 +'Омск': user5 +'Самара': user3, someuser diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login.json b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login.json new file mode 100644 index 000000000..ff5b59cd3 --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login.json @@ -0,0 +1,58 @@ +[ + { + "allowed_value": "Москва", + "subject": { + "subject_id": "1120000000000529", + "subject_type": "user", + "subject_name": "user1" + } + }, + { + "allowed_value": "Москва", + "subject": { + "subject_id": "1120000000019416", + "subject_type": "user", + "subject_name": "user2" + } + }, + { + "allowed_value": "Москва", + "subject": { + "subject_id": "", + "subject_type": "notfound", + "subject_name": "!FAILED_robot-user2" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "1120000000001001", + "subject_type": "user", + "subject_name": "user3" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "1120000000000529", + "subject_type": "user", + "subject_name": "user1" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "", + "subject_type": "notfound", + "subject_name": "!FAILED_someuser" + } + }, + { + "allowed_value": "Омск", + "subject": { + "subject_id": "1120000000000251", + "subject_type": "user", + "subject_name": "user5" + } + } +] diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_to_compare b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_to_compare new file mode 100644 index 000000000..12fbbc720 --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_to_compare @@ -0,0 +1,3 @@ +'Москва': user2, !FAILED_robot-user2, user1 +'Самара': user3, !FAILED_someuser, user1 +'Омск': user5 diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_updated b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_updated new file mode 100644 index 000000000..488798cc4 --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_updated @@ -0,0 +1,3 @@ +'Москва': user2, user1 +'Самара': user3, !FAILED_someuser, user1 +'Омск': user5, pg diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_updated.json b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_updated.json new file mode 100644 index 000000000..1f058217f --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/missing_login_updated.json @@ -0,0 +1,58 @@ +[ + { + "allowed_value": "Москва", + "subject": { + "subject_id": "1120000000019416", + "subject_type": "user", + "subject_name": "user2" + } + }, + { + "allowed_value": "Москва", + "subject": { + "subject_id": "1120000000000529", + "subject_type": "user", + "subject_name": "user1" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "1120000000001001", + "subject_type": "user", + "subject_name": "user3" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "1120000000000529", + "subject_type": "user", + "subject_name": "user1" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "", + "subject_type": "notfound", + "subject_name": "!FAILED_someuser" + } + }, + { + "allowed_value": "Омск", + "subject": { + "subject_id": "1120000000000251", + "subject_type": "user", + "subject_name": "user5" + } + }, + { + "allowed_value": "Омск", + "subject": { + "subject_id": "1120000000000251", + "subject_type": "user", + "subject_name": "pg" + } + } +] diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/simple b/lib/dl_testing/dl_testing/test_data/rls_configs/simple new file mode 100644 index 000000000..13b73aede --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/simple @@ -0,0 +1,4 @@ +'Москва': user1,user2 +'Самара': user1, user3 +'Омск': user5 +'Самара': user3 diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/simple.json b/lib/dl_testing/dl_testing/test_data/rls_configs/simple.json new file mode 100644 index 000000000..41ad9a21f --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/simple.json @@ -0,0 +1,42 @@ +[ + { + "allowed_value": "Москва", + "subject": { + "subject_id": "1120000000000529", + "subject_type": "user", + "subject_name": "user1" + } + }, + { + "allowed_value": "Москва", + "subject": { + "subject_id": "1120000000019416", + "subject_type": "user", + "subject_name": "user2" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "1120000000001001", + "subject_type": "user", + "subject_name": "user3" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "1120000000000529", + "subject_type": "user", + "subject_name": "user1" + } + }, + { + "allowed_value": "Омск", + "subject": { + "subject_id": "1120000000000251", + "subject_type": "user", + "subject_name": "user5" + } + } +] diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/simple_to_compare b/lib/dl_testing/dl_testing/test_data/rls_configs/simple_to_compare new file mode 100644 index 000000000..a0018dd27 --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/simple_to_compare @@ -0,0 +1,3 @@ +'Москва': user1, user2 +'Самара': user1, user3 +'Омск': user5 diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/simple_updated b/lib/dl_testing/dl_testing/test_data/rls_configs/simple_updated new file mode 100644 index 000000000..7ab13577f --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/simple_updated @@ -0,0 +1,3 @@ +'Москва': user2 +'Самара': user1, user3 +'Омск': user5, pg diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/simple_updated.json b/lib/dl_testing/dl_testing/test_data/rls_configs/simple_updated.json new file mode 100644 index 000000000..2fdf870ec --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/simple_updated.json @@ -0,0 +1,42 @@ +[ + { + "allowed_value": "Москва", + "subject": { + "subject_id": "1120000000019416", + "subject_type": "user", + "subject_name": "user2" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "1120000000001001", + "subject_type": "user", + "subject_name": "user3" + } + }, + { + "allowed_value": "Самара", + "subject": { + "subject_id": "1120000000000529", + "subject_type": "user", + "subject_name": "user1" + } + }, + { + "allowed_value": "Омск", + "subject": { + "subject_id": "1120000000000251", + "subject_type": "user", + "subject_name": "user5" + } + }, + { + "allowed_value": "Омск", + "subject": { + "subject_id": "1120000000000251", + "subject_type": "user", + "subject_name": "pg" + } + } +] diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/wildcards b/lib/dl_testing/dl_testing/test_data/rls_configs/wildcards new file mode 100644 index 000000000..5457ce1e9 --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/wildcards @@ -0,0 +1,7 @@ +'Москва': * +'Санкт-Петербург': * +*: user1 +*: user4, user5 +'Омск': user5 +userid: userid +'Владивосток': user6 diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/wildcards.json b/lib/dl_testing/dl_testing/test_data/rls_configs/wildcards.json new file mode 100644 index 000000000..801266566 --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/wildcards.json @@ -0,0 +1,34 @@ +[ + { + "allowed_value": "Москва", + "subject": {"subject_type": "all", "subject_id": "*", "subject_name": "*"} + }, + { + "allowed_value": "Санкт-Петербург", + "subject": {"subject_type": "all", "subject_id": "*", "subject_name": "*"} + }, + { + "pattern_type": "all", "allowed_value": null, + "subject": {"subject_type": "user", "subject_id": "1120000000000529", "subject_name": "user1"} + }, + { + "pattern_type": "all", "allowed_value": null, + "subject": {"subject_type": "user", "subject_id": "1120000000001062", "subject_name": "user4"} + }, + { + "pattern_type": "all", "allowed_value": null, + "subject": {"subject_type": "user", "subject_id": "1120000000000251", "subject_name": "user5"} + }, + { + "allowed_value": "Омск", + "subject": {"subject_type": "user", "subject_id": "1120000000000251", "subject_name": "user5"} + }, + { + "pattern_type": "userid", "allowed_value": null, + "subject": {"subject_type": "userid", "subject_id": "", "subject_name": "userid"} + }, + { + "allowed_value": "Владивосток", + "subject": {"subject_type": "user", "subject_id": "1120000000013893", "subject_name": "user6"} + } +] diff --git a/lib/dl_testing/dl_testing/test_data/rls_configs/wildcards_to_compare b/lib/dl_testing/dl_testing/test_data/rls_configs/wildcards_to_compare new file mode 100644 index 000000000..39716f077 --- /dev/null +++ b/lib/dl_testing/dl_testing/test_data/rls_configs/wildcards_to_compare @@ -0,0 +1,6 @@ +'Москва': * +'Санкт-Петербург': * +*: user1, user4, user5 +'Омск': user5 +userid: userid +'Владивосток': user6