From: Nick Porter Date: Mon, 8 Apr 2024 13:23:12 +0000 (+0100) Subject: Test SQL cache_groups option X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25e6994d4659109aaf1c822ad55cda64e43f51ef;p=thirdparty%2Ffreeradius-server.git Test SQL cache_groups option --- diff --git a/src/tests/modules/sql/groups.unlang b/src/tests/modules/sql/groups.unlang index 89481cf0b8e..6aa6622b882 100644 --- a/src/tests/modules/sql/groups.unlang +++ b/src/tests/modules/sql/groups.unlang @@ -45,6 +45,22 @@ if !(&reply.Reply-Message == "Hello User B") { test_fail } +if (&control.SQL-Group[*] == 'groups_group_a') { + test_fail +} + +if !(&control.SQL-Group[*] == 'groups_group_b') { + test_fail +} + +# +# Although the user is in this group, the lack of Fall-Through in radgroupreply +# means this will never be processed when calling the sql module in authorize context. +# +if (&control.SQL-Group[*] == 'groups_group_c') { + test_fail +} + # # Test paircmp group comparisons # diff --git a/src/tests/modules/sql/groups_fall_through.unlang b/src/tests/modules/sql/groups_fall_through.unlang index bbb6951dd76..46811138645 100644 --- a/src/tests/modules/sql/groups_fall_through.unlang +++ b/src/tests/modules/sql/groups_fall_through.unlang @@ -44,4 +44,16 @@ if !(&reply.Reply-Message == "Hello Fallthrough User") { test_fail } +if !(&control.SQL-Group[*] == 'fallthrough_group_a') { + test_fail +} + +if !(&control.SQL-Group[*] == 'fallthrough_group_b') { + test_fail +} + +if (&control.SQL-Group[*] == 'fallthrough_group_c') { + test_fail +} + test_pass diff --git a/src/tests/modules/sql_mysql/module.conf b/src/tests/modules/sql_mysql/module.conf index fc0183da803..a2a4a83a12d 100644 --- a/src/tests/modules/sql_mysql/module.conf +++ b/src/tests/modules/sql_mysql/module.conf @@ -38,6 +38,7 @@ sql { # The group attribute specific to this instance of rlm_sql group_attribute = "SQL-Group" + cache_groups = yes # Read database-specific queries $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries.conf diff --git a/src/tests/modules/sql_postgresql/module.conf b/src/tests/modules/sql_postgresql/module.conf index 83b1b12bf9e..a7fe73fb082 100644 --- a/src/tests/modules/sql_postgresql/module.conf +++ b/src/tests/modules/sql_postgresql/module.conf @@ -38,6 +38,7 @@ sql { # The group attribute specific to this instance of rlm_sql group_attribute = "SQL-Group" + cache_groups = yes # Read database-specific queries $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries.conf diff --git a/src/tests/modules/sql_sqlite/module.conf b/src/tests/modules/sql_sqlite/module.conf index 7fb9dc75f89..c6bbb89c195 100644 --- a/src/tests/modules/sql_sqlite/module.conf +++ b/src/tests/modules/sql_sqlite/module.conf @@ -37,6 +37,7 @@ sql { # The group attribute specific to this instance of rlm_sql group_attribute = "SQL-Group" + cache_groups = yes # Read database-specific queries $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries.conf