Don't use instance name in SQL module tests.
[freeradius.git] / src / tests / modules / sql_mysql / acct_start_conflict.unlang
1 #
2 #  PRE: acct_2_stop
3 #
4
5 #
6 #  Check that conflicting unique IDs triggers failover to alternative query
7 #
8
9 #
10 #  Clear out old data
11 #
12 update {
13         Tmp-String-0 := "%{sql:DELETE FROM radacct WHERE AcctSessionId = '00000001'}"
14 }
15 if (!&Tmp-String-0) {
16         test_fail
17 }
18 else {
19         test_pass
20 }
21
22 #
23 #  Insert the Accounting-Request start
24 #
25 sql.accounting
26 if (ok) {
27         test_pass
28 }
29 else {
30         test_fail
31 }
32
33 #
34 #  Check the database has at least one row
35 #
36 update {
37         Tmp-Integer-0 := "%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000001'}"
38 }
39 if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 1)) {
40         test_fail
41 }
42 else {
43         test_pass
44 }
45
46 #
47 #  Check acctsessiontime matches the value in the request
48 #
49 update {
50         Tmp-Integer-0 := "%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000001'}"
51 }
52 if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 0)) {
53         test_fail
54 }
55 else {
56         test_pass
57 }
58
59 #
60 #  Change acctsessiontime and verify it's updated
61 #
62 update request {
63         Connect-Info = 'updated'
64 }
65 sql.accounting
66 if (ok) {
67         test_pass
68 }
69 else {
70         test_pass
71 }
72 update {
73         Tmp-String-0 := "%{sql:SELECT connectinfo_start FROM radacct WHERE AcctSessionId = '00000001'}"
74 }
75 if (!&Tmp-Integer-0 || (&Tmp-String-0 != 'updated')) {
76         test_fail
77 }
78 else {
79         test_pass
80 }