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