From: Arran Cudbard-Bell Date: Sat, 14 Sep 2019 03:05:39 +0000 (-0500) Subject: Reorganise tests, and add explicit test for shared storage X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da1cb29ec546748dec354dbe7467974b02bc6304;p=thirdparty%2Ffreeradius-server.git Reorganise tests, and add explicit test for shared storage --- diff --git a/src/tests/modules/python/auth_with_shared_storage.attrs b/src/tests/modules/python/auth_with_shared_storage.attrs new file mode 100644 index 00000000000..b2b037f71b6 --- /dev/null +++ b/src/tests/modules/python/auth_with_shared_storage.attrs @@ -0,0 +1,10 @@ +# +# Input packet +# +User-Name = "bob" +User-Password = "hello" + +# +# Expected answer +# +Response-Packet-Type == Access-Accept \ No newline at end of file diff --git a/src/tests/modules/python/auth_with_shared_storage.unlang b/src/tests/modules/python/auth_with_shared_storage.unlang new file mode 100644 index 00000000000..155ddbc14dc --- /dev/null +++ b/src/tests/modules/python/auth_with_shared_storage.unlang @@ -0,0 +1,15 @@ +# Should return noop (no shared variable set) +pmod_shared_storage +if (noop) { + test_pass +} else { + test_fail +} + +# Should return ok (shared variable set) +pmod_shared_storage +if (ok) { + test_fail +} else { + test_pass +} diff --git a/src/tests/modules/python/mod2.py b/src/tests/modules/python/mod_return_ok.py similarity index 100% rename from src/tests/modules/python/mod2.py rename to src/tests/modules/python/mod_return_ok.py diff --git a/src/tests/modules/python/mod3.py b/src/tests/modules/python/mod_shared_storage.py similarity index 100% rename from src/tests/modules/python/mod3.py rename to src/tests/modules/python/mod_shared_storage.py diff --git a/src/tests/modules/python/mod1.py b/src/tests/modules/python/mod_thread_local_storage.py similarity index 100% rename from src/tests/modules/python/mod1.py rename to src/tests/modules/python/mod_thread_local_storage.py diff --git a/src/tests/modules/python/mod4.py b/src/tests/modules/python/mod_with_config.py similarity index 100% rename from src/tests/modules/python/mod4.py rename to src/tests/modules/python/mod_with_config.py diff --git a/src/tests/modules/python/module.conf b/src/tests/modules/python/module.conf index 04bd63ea93f..5d7072e71fc 100644 --- a/src/tests/modules/python/module.conf +++ b/src/tests/modules/python/module.conf @@ -1,67 +1,80 @@ + +# +# Each of these module instances creates its own interpreter instance +# so for shared storage unless cext_compat is true and we're running +# Python 2.7 or below. +# python pmod1 { - module = 'mod1' + module = 'mod_thread_local_storage' - mod_authorize = ${.module} - func_authorize = authorize + mod_authorize = ${.module} + func_authorize = authorize } python pmod2 { - module = 'mod2' + module = 'mod_return_ok' - mod_authorize = ${.module} - func_authorize = authorize + mod_authorize = ${.module} + func_authorize = authorize } python pmod3_withmod1 { - module = 'mod1' + module = 'mod_thread_local_storage' - mod_authorize = ${.module} - func_authorize = authorize + mod_authorize = ${.module} + func_authorize = authorize } python pmod4_cextcompat { - module = 'mod3' + module = 'mod_shared_storage' - mod_authorize = ${.module} - func_authorize = authorize + mod_authorize = ${.module} + func_authorize = authorize - cext_compat = true + cext_compat = true } python pmod5_cextcompat { - module = 'mod3' + module = 'mod_shared_storage' - mod_authorize = ${.module} - func_authorize = authorize + mod_authorize = ${.module} + func_authorize = authorize - cext_compat = true + cext_compat = true } python pmod4_not_cextcompat { - module = 'mod3' + module = 'mod_shared_storage' - mod_authorize = ${.module} - func_authorize = authorize + mod_authorize = ${.module} + func_authorize = authorize - cext_compat = false + cext_compat = false } python pmod5_not_cextcompat { - module = 'mod3' + module = 'mod_shared_storage' - mod_authorize = ${.module} - func_authorize = authorize + mod_authorize = ${.module} + func_authorize = authorize - cext_compat = false + cext_compat = false } python pmod6_configured { - module = 'mod4' + module = 'mod_with_config' + + mod_authorize = ${.module} + func_authorize = authorize - mod_authorize = ${.module} - func_authorize = authorize + config { + a_param = "a_value" + } +} - config { - a_param = "a_value" - } -} \ No newline at end of file +python pmod_shared_storage { + module = 'mod_shared_storage' + + mod_authorize = ${.module} + func_authorize = authorize +}