]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Move tests to be used by all SQL flavours
authorNick Porter <nick@portercomputing.co.uk>
Tue, 22 Oct 2024 07:10:13 +0000 (08:10 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 22 Oct 2024 07:10:13 +0000 (08:10 +0100)
24 files changed:
src/tests/modules/sql/attrref.attrs [new file with mode: 0644]
src/tests/modules/sql/attrref.unlang [new file with mode: 0644]
src/tests/modules/sql/nested.attrs [new file with mode: 0644]
src/tests/modules/sql/nested.unlang [new file with mode: 0644]
src/tests/modules/sql/xlat.attrs [new file with mode: 0644]
src/tests/modules/sql/xlat.unlang [new file with mode: 0644]
src/tests/modules/sql_mysql/attrref.attrs [new symlink]
src/tests/modules/sql_mysql/attrref.unlang [new symlink]
src/tests/modules/sql_mysql/nested.attrs [new symlink]
src/tests/modules/sql_mysql/nested.unlang [new symlink]
src/tests/modules/sql_mysql/xlat.attrs [new symlink]
src/tests/modules/sql_mysql/xlat.unlang [new symlink]
src/tests/modules/sql_postgresql/attrref.attrs [new symlink]
src/tests/modules/sql_postgresql/attrref.unlang [new symlink]
src/tests/modules/sql_postgresql/nested.attrs [new symlink]
src/tests/modules/sql_postgresql/nested.unlang [new symlink]
src/tests/modules/sql_postgresql/xlat.attrs [new symlink]
src/tests/modules/sql_postgresql/xlat.unlang [new symlink]
src/tests/modules/sql_sqlite/attrref.attrs [changed from file to symlink]
src/tests/modules/sql_sqlite/attrref.unlang [changed from file to symlink]
src/tests/modules/sql_sqlite/nested.attrs [changed from file to symlink]
src/tests/modules/sql_sqlite/nested.unlang [changed from file to symlink]
src/tests/modules/sql_sqlite/xlat.attrs [changed from file to symlink]
src/tests/modules/sql_sqlite/xlat.unlang [changed from file to symlink]

diff --git a/src/tests/modules/sql/attrref.attrs b/src/tests/modules/sql/attrref.attrs
new file mode 100644 (file)
index 0000000..32d40c7
--- /dev/null
@@ -0,0 +1,14 @@
+#
+#  Input packet
+#
+Packet-Type = Access-Request
+User-Name = "attrref"
+User-Password = "password"
+NAS-IP-Address = "1.2.3.4"
+Framed-IP-Address = "1.2.3.4"
+
+#
+#  Expected answer
+#
+Packet-Type == Access-Accept
+Idle-Timeout == 3600
diff --git a/src/tests/modules/sql/attrref.unlang b/src/tests/modules/sql/attrref.unlang
new file mode 100644 (file)
index 0000000..09544bd
--- /dev/null
@@ -0,0 +1,19 @@
+#
+#  Clear out old data
+#
+%sql("${delete_from_radcheck} 'attrref'")
+%sql("${delete_from_radreply} 'attrref'")
+
+if (%sql("${insert_into_radcheck} ('attrref', 'NAS-IP-Address', '==', '&Framed-IP-Address')") != "1") {
+       test_fail
+}
+
+if (%sql("${insert_into_radcheck} ('attrref', 'Password.Cleartext', ':=', 'password')") != "1") {
+       test_fail
+}
+
+if (%sql("${insert_into_radreply} ('attrref', 'Idle-Timeout', ':=', '3600')") != "1") {
+       test_fail
+}
+
+sql
diff --git a/src/tests/modules/sql/nested.attrs b/src/tests/modules/sql/nested.attrs
new file mode 100644 (file)
index 0000000..40131c0
--- /dev/null
@@ -0,0 +1,14 @@
+#
+#  Input packet
+#
+Packet-Type = Access-Request
+User-Name = "user_auth_nested"
+User-Password = "password"
+NAS-IP-Address = "1.2.3.4"
+
+#
+#  Expected answer
+#
+Packet-Type == Access-Accept
+Idle-Timeout == 3600
+Digest-Attributes == { Nonce == "dcd98b7102dd2f0e8b11d0f600bfb0c093", Method == "Invite", URI == "sip:bob@biloxi.com" }
diff --git a/src/tests/modules/sql/nested.unlang b/src/tests/modules/sql/nested.unlang
new file mode 100644 (file)
index 0000000..443a61b
--- /dev/null
@@ -0,0 +1,51 @@
+#
+#  Clear out old data.  We don't care if the deletion deletes any rows.
+#
+%sql("${delete_from_radcheck} 'user_auth_nested'")
+%sql("${delete_from_radreply} 'user_auth_nested'")
+
+#
+#  Add in the check items.
+#
+if (%sql("${insert_into_radcheck} ('user_auth_nested', 'NAS-IP-Address', '==', '1.2.3.4')") != "1") {
+       test_fail
+}
+
+if (%sql("${insert_into_radcheck} ('user_auth_nested', 'Password.Cleartext', ':=', 'password')") != "1") {
+       test_fail
+}
+
+#
+#  Add in the reply items.
+#
+if (%sql("${insert_into_radreply} ('user_auth_nested', 'Idle-Timeout', ':=', '3600')") != "1") {
+       test_fail
+}
+
+if (0) {
+if (%sql("${insert_into_radreply} ('user_auth_nested', 'Digest-Attributes', ':=', 'Nonce = \"dcd98b7102dd2f0e8b11d0f600bfb0c093\", Method = \"Invite\", URI = \"sip:bob@biloxi.com\"')") != "1") {
+       test_fail
+}
+
+} else {
+if (%sql("${insert_into_radreply} ('user_auth_nested', 'Digest-Attributes', ':=', '')") != "1") {
+       test_fail
+}
+
+if (%sql("${insert_into_radreply} ('user_auth_nested', '.Nonce', '=', 'dcd98b7102dd2f0e8b11d0f600bfb0c093')") != "1") {
+       test_fail
+}
+
+if (%sql("${insert_into_radreply} ('user_auth_nested', '.Method', '=', 'Invite')") != "1") {
+       test_fail
+}
+
+if (%sql("${insert_into_radreply} ('user_auth_nested', '.URI', '=', 'sip:bob@biloxi.com')") != "1") {
+       test_fail
+}
+}
+
+#
+#  Run the SQL module to get the replies.
+#
+sql
diff --git a/src/tests/modules/sql/xlat.attrs b/src/tests/modules/sql/xlat.attrs
new file mode 100644 (file)
index 0000000..3e1af7b
--- /dev/null
@@ -0,0 +1,13 @@
+#
+#  Input packet
+#
+Packet-Type = Access-Request
+User-Name = "xlat"
+User-Password = "password"
+NAS-IP-Address = "1.2.3.4"
+
+#
+#  Expected answer
+#
+Packet-Type == Access-Accept
+Reply-Message == "Hello xlat"
diff --git a/src/tests/modules/sql/xlat.unlang b/src/tests/modules/sql/xlat.unlang
new file mode 100644 (file)
index 0000000..be14a37
--- /dev/null
@@ -0,0 +1,15 @@
+#
+#  Clear out old data
+#
+%sql("${delete_from_radcheck} 'xlat'")
+%sql("${delete_from_radreply} 'xlat'")
+
+if (%sql("${insert_into_radcheck} ('%{User-Name}', 'Password.Cleartext', ':=', 'password')") != "1") {
+       test_fail
+}
+
+if (%sql("${insert_into_radreply} ('%{User-Name}', 'Reply-Message', ':=', '\"Hello \%{User-Name}\"')") != "1") {
+       test_fail
+}
+
+sql
diff --git a/src/tests/modules/sql_mysql/attrref.attrs b/src/tests/modules/sql_mysql/attrref.attrs
new file mode 120000 (symlink)
index 0000000..a8a5c1b
--- /dev/null
@@ -0,0 +1 @@
+../sql/attrref.attrs
\ No newline at end of file
diff --git a/src/tests/modules/sql_mysql/attrref.unlang b/src/tests/modules/sql_mysql/attrref.unlang
new file mode 120000 (symlink)
index 0000000..f001171
--- /dev/null
@@ -0,0 +1 @@
+../sql/attrref.unlang
\ No newline at end of file
diff --git a/src/tests/modules/sql_mysql/nested.attrs b/src/tests/modules/sql_mysql/nested.attrs
new file mode 120000 (symlink)
index 0000000..c591061
--- /dev/null
@@ -0,0 +1 @@
+../sql/nested.attrs
\ No newline at end of file
diff --git a/src/tests/modules/sql_mysql/nested.unlang b/src/tests/modules/sql_mysql/nested.unlang
new file mode 120000 (symlink)
index 0000000..b742ca9
--- /dev/null
@@ -0,0 +1 @@
+../sql/nested.unlang
\ No newline at end of file
diff --git a/src/tests/modules/sql_mysql/xlat.attrs b/src/tests/modules/sql_mysql/xlat.attrs
new file mode 120000 (symlink)
index 0000000..08ddf2e
--- /dev/null
@@ -0,0 +1 @@
+../sql/xlat.attrs
\ No newline at end of file
diff --git a/src/tests/modules/sql_mysql/xlat.unlang b/src/tests/modules/sql_mysql/xlat.unlang
new file mode 120000 (symlink)
index 0000000..4d14f02
--- /dev/null
@@ -0,0 +1 @@
+../sql/xlat.unlang
\ No newline at end of file
diff --git a/src/tests/modules/sql_postgresql/attrref.attrs b/src/tests/modules/sql_postgresql/attrref.attrs
new file mode 120000 (symlink)
index 0000000..a8a5c1b
--- /dev/null
@@ -0,0 +1 @@
+../sql/attrref.attrs
\ No newline at end of file
diff --git a/src/tests/modules/sql_postgresql/attrref.unlang b/src/tests/modules/sql_postgresql/attrref.unlang
new file mode 120000 (symlink)
index 0000000..f001171
--- /dev/null
@@ -0,0 +1 @@
+../sql/attrref.unlang
\ No newline at end of file
diff --git a/src/tests/modules/sql_postgresql/nested.attrs b/src/tests/modules/sql_postgresql/nested.attrs
new file mode 120000 (symlink)
index 0000000..c591061
--- /dev/null
@@ -0,0 +1 @@
+../sql/nested.attrs
\ No newline at end of file
diff --git a/src/tests/modules/sql_postgresql/nested.unlang b/src/tests/modules/sql_postgresql/nested.unlang
new file mode 120000 (symlink)
index 0000000..b742ca9
--- /dev/null
@@ -0,0 +1 @@
+../sql/nested.unlang
\ No newline at end of file
diff --git a/src/tests/modules/sql_postgresql/xlat.attrs b/src/tests/modules/sql_postgresql/xlat.attrs
new file mode 120000 (symlink)
index 0000000..08ddf2e
--- /dev/null
@@ -0,0 +1 @@
+../sql/xlat.attrs
\ No newline at end of file
diff --git a/src/tests/modules/sql_postgresql/xlat.unlang b/src/tests/modules/sql_postgresql/xlat.unlang
new file mode 120000 (symlink)
index 0000000..4d14f02
--- /dev/null
@@ -0,0 +1 @@
+../sql/xlat.unlang
\ No newline at end of file
deleted file mode 100644 (file)
index 32d40c7d2d6a33a51474c2fc676dcb8b64a57fb7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-#  Input packet
-#
-Packet-Type = Access-Request
-User-Name = "attrref"
-User-Password = "password"
-NAS-IP-Address = "1.2.3.4"
-Framed-IP-Address = "1.2.3.4"
-
-#
-#  Expected answer
-#
-Packet-Type == Access-Accept
-Idle-Timeout == 3600
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..a8a5c1bb227bfd0b4c111031ba1c5cbdfab5a4ed
--- /dev/null
@@ -0,0 +1 @@
+../sql/attrref.attrs
\ No newline at end of file
deleted file mode 100644 (file)
index 09544bdf7a73cbb3dd909628504e4670a9078096..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-#  Clear out old data
-#
-%sql("${delete_from_radcheck} 'attrref'")
-%sql("${delete_from_radreply} 'attrref'")
-
-if (%sql("${insert_into_radcheck} ('attrref', 'NAS-IP-Address', '==', '&Framed-IP-Address')") != "1") {
-       test_fail
-}
-
-if (%sql("${insert_into_radcheck} ('attrref', 'Password.Cleartext', ':=', 'password')") != "1") {
-       test_fail
-}
-
-if (%sql("${insert_into_radreply} ('attrref', 'Idle-Timeout', ':=', '3600')") != "1") {
-       test_fail
-}
-
-sql
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..f001171bccf99fc59e3f3882fa1430706138fcfe
--- /dev/null
@@ -0,0 +1 @@
+../sql/attrref.unlang
\ No newline at end of file
deleted file mode 100644 (file)
index 40131c09370c02aee377ad4eb80aca6f580fc978..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-#  Input packet
-#
-Packet-Type = Access-Request
-User-Name = "user_auth_nested"
-User-Password = "password"
-NAS-IP-Address = "1.2.3.4"
-
-#
-#  Expected answer
-#
-Packet-Type == Access-Accept
-Idle-Timeout == 3600
-Digest-Attributes == { Nonce == "dcd98b7102dd2f0e8b11d0f600bfb0c093", Method == "Invite", URI == "sip:bob@biloxi.com" }
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..c59106145bec769edbafeeff2a6f0b322b1f0643
--- /dev/null
@@ -0,0 +1 @@
+../sql/nested.attrs
\ No newline at end of file
deleted file mode 100644 (file)
index 443a61b553a317ea78fc915a6a9722cc60664557..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-#  Clear out old data.  We don't care if the deletion deletes any rows.
-#
-%sql("${delete_from_radcheck} 'user_auth_nested'")
-%sql("${delete_from_radreply} 'user_auth_nested'")
-
-#
-#  Add in the check items.
-#
-if (%sql("${insert_into_radcheck} ('user_auth_nested', 'NAS-IP-Address', '==', '1.2.3.4')") != "1") {
-       test_fail
-}
-
-if (%sql("${insert_into_radcheck} ('user_auth_nested', 'Password.Cleartext', ':=', 'password')") != "1") {
-       test_fail
-}
-
-#
-#  Add in the reply items.
-#
-if (%sql("${insert_into_radreply} ('user_auth_nested', 'Idle-Timeout', ':=', '3600')") != "1") {
-       test_fail
-}
-
-if (0) {
-if (%sql("${insert_into_radreply} ('user_auth_nested', 'Digest-Attributes', ':=', 'Nonce = \"dcd98b7102dd2f0e8b11d0f600bfb0c093\", Method = \"Invite\", URI = \"sip:bob@biloxi.com\"')") != "1") {
-       test_fail
-}
-
-} else {
-if (%sql("${insert_into_radreply} ('user_auth_nested', 'Digest-Attributes', ':=', '')") != "1") {
-       test_fail
-}
-
-if (%sql("${insert_into_radreply} ('user_auth_nested', '.Nonce', '=', 'dcd98b7102dd2f0e8b11d0f600bfb0c093')") != "1") {
-       test_fail
-}
-
-if (%sql("${insert_into_radreply} ('user_auth_nested', '.Method', '=', 'Invite')") != "1") {
-       test_fail
-}
-
-if (%sql("${insert_into_radreply} ('user_auth_nested', '.URI', '=', 'sip:bob@biloxi.com')") != "1") {
-       test_fail
-}
-}
-
-#
-#  Run the SQL module to get the replies.
-#
-sql
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..b742ca954b78abd2cb19f672a7fc6be431c5c17d
--- /dev/null
@@ -0,0 +1 @@
+../sql/nested.unlang
\ No newline at end of file
deleted file mode 100644 (file)
index 3e1af7b75a5c7530515090d7d33727127afc9d20..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-#  Input packet
-#
-Packet-Type = Access-Request
-User-Name = "xlat"
-User-Password = "password"
-NAS-IP-Address = "1.2.3.4"
-
-#
-#  Expected answer
-#
-Packet-Type == Access-Accept
-Reply-Message == "Hello xlat"
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..08ddf2e7aa1e21b3d6cd2f41da08068dec38e6b9
--- /dev/null
@@ -0,0 +1 @@
+../sql/xlat.attrs
\ No newline at end of file
deleted file mode 100644 (file)
index be14a371dce5e8aa60ab0ce1cc6a45aef1ea22f7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-#  Clear out old data
-#
-%sql("${delete_from_radcheck} 'xlat'")
-%sql("${delete_from_radreply} 'xlat'")
-
-if (%sql("${insert_into_radcheck} ('%{User-Name}', 'Password.Cleartext', ':=', 'password')") != "1") {
-       test_fail
-}
-
-if (%sql("${insert_into_radreply} ('%{User-Name}', 'Reply-Message', ':=', '\"Hello \%{User-Name}\"')") != "1") {
-       test_fail
-}
-
-sql
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..4d14f02b3a2540ecc974430b31f35937d3d79e59
--- /dev/null
@@ -0,0 +1 @@
+../sql/xlat.unlang
\ No newline at end of file