diff options
Diffstat (limited to 'src/tests/modules/sql/acct_start_conflict.unlang')
-rw-r--r-- | src/tests/modules/sql/acct_start_conflict.unlang | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/tests/modules/sql/acct_start_conflict.unlang b/src/tests/modules/sql/acct_start_conflict.unlang new file mode 100644 index 0000000..65e69e0 --- /dev/null +++ b/src/tests/modules/sql/acct_start_conflict.unlang @@ -0,0 +1,76 @@ +# +# Check that conflicting unique IDs triggers failover to alternative query +# + +# +# Clear out old data +# +update { + Tmp-String-0 := "%{sql:DELETE FROM radacct WHERE AcctSessionId = '00000003'}" +} +if (!&Tmp-String-0) { + test_fail +} +else { + test_pass +} + +# +# Insert the Accounting-Request start +# +sql.accounting +if (ok) { + test_pass +} +else { + test_fail +} + +# +# Check the database has at least one row +# +update { + Tmp-Integer-0 := "%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000003'}" +} +if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 1)) { + test_fail +} +else { + test_pass +} + +# +# Check acctsessiontime matches the value in the request +# +update { + Tmp-Integer-0 := "%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000003'}" +} +if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 0)) { + test_fail +} +else { + test_pass +} + +# +# Change acctsessiontime and verify it's updated +# +update request { + Connect-Info = 'updated' +} +sql.accounting +if (ok) { + test_pass +} +else { + test_fail +} +update { + Tmp-String-0 := "%{sql:SELECT connectinfo_start FROM radacct WHERE AcctSessionId = '00000003'}" +} +if (!&Tmp-Integer-0 || (&Tmp-String-0 != 'updated')) { + test_fail +} +else { + test_pass +} |