]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Reorganise tests, and add explicit test for shared storage
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 14 Sep 2019 03:05:39 +0000 (22:05 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 14 Sep 2019 03:05:48 +0000 (22:05 -0500)
src/tests/modules/python/auth_with_shared_storage.attrs [new file with mode: 0644]
src/tests/modules/python/auth_with_shared_storage.unlang [new file with mode: 0644]
src/tests/modules/python/mod_return_ok.py [moved from src/tests/modules/python/mod2.py with 100% similarity]
src/tests/modules/python/mod_shared_storage.py [moved from src/tests/modules/python/mod3.py with 100% similarity]
src/tests/modules/python/mod_thread_local_storage.py [moved from src/tests/modules/python/mod1.py with 100% similarity]
src/tests/modules/python/mod_with_config.py [moved from src/tests/modules/python/mod4.py with 100% similarity]
src/tests/modules/python/module.conf

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 (file)
index 0000000..b2b037f
--- /dev/null
@@ -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 (file)
index 0000000..155ddbc
--- /dev/null
@@ -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
+}
index 04bd63ea93faced21b79146cfae2d76060245cc3..5d7072e71fc042ed3d03d1957280906bccba5b69 100644 (file)
@@ -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
+}