summaryrefslogtreecommitdiffstats
path: root/tests/db/db_test.err
blob: ac0e2f137b50ba12123f91e3c174225cd732760e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
===== test_subscr_create_update_sel_delete

--- Create with valid / invalid IMSI

db_subscr_create(dbc, imsi0) --> 0

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
}

db_subscr_create(dbc, imsi1) --> 0

db_subscr_get_by_imsi(dbc, imsi1, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 2,
  .imsi = '123456789000001',
}

db_subscr_create(dbc, imsi2) --> 0

db_subscr_get_by_imsi(dbc, imsi2, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 3,
  .imsi = '123456789000002',
}

db_subscr_create(dbc, imsi0) --> -EIO
DDB (2067) abort at 18 in [INSERT INTO subscriber (imsi) VALUES ($imsi)]: UNIQUE constraint failed: subscriber.imsi
DDB Error in sqlite3_reset: 2067
DAUC IMSI='123456789000000': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
}

db_subscr_create(dbc, imsi1) --> -EIO
DDB (2067) abort at 18 in [INSERT INTO subscriber (imsi) VALUES ($imsi)]: UNIQUE constraint failed: subscriber.imsi
DDB Error in sqlite3_reset: 2067
DAUC IMSI='123456789000001': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi

db_subscr_create(dbc, imsi1) --> -EIO
DDB (2067) abort at 18 in [INSERT INTO subscriber (imsi) VALUES ($imsi)]: UNIQUE constraint failed: subscriber.imsi
DDB Error in sqlite3_reset: 2067
DAUC IMSI='123456789000001': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi

db_subscr_get_by_imsi(dbc, imsi1, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 2,
  .imsi = '123456789000001',
}

db_subscr_create(dbc, imsi2) --> -EIO
DDB (2067) abort at 18 in [INSERT INTO subscriber (imsi) VALUES ($imsi)]: UNIQUE constraint failed: subscriber.imsi
DDB Error in sqlite3_reset: 2067
DAUC IMSI='123456789000002': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi

db_subscr_create(dbc, imsi2) --> -EIO
DDB (2067) abort at 18 in [INSERT INTO subscriber (imsi) VALUES ($imsi)]: UNIQUE constraint failed: subscriber.imsi
DDB Error in sqlite3_reset: 2067
DAUC IMSI='123456789000002': Cannot create subscriber: SQL error: (2067) UNIQUE constraint failed: subscriber.imsi

db_subscr_get_by_imsi(dbc, imsi2, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 3,
  .imsi = '123456789000002',
}

db_subscr_create(dbc, "123456789 000003") --> -EINVAL
DAUC Cannot create subscriber: invalid IMSI: '123456789 000003'

db_subscr_get_by_imsi(dbc, "123456789000003", &g_subscr) --> -ENOEXEC
DAUC IMSI='123456789000003': Error executing SQL: 101

db_subscr_create(dbc, "123456789000002123456") --> -EINVAL
DAUC Cannot create subscriber: invalid IMSI: '123456789000002123456'

db_subscr_get_by_imsi(dbc, "123456789000002123456", &g_subscr) --> -ENOEXEC
DAUC IMSI='123456789000002123456': Error executing SQL: 101

db_subscr_create(dbc, "foobar123") --> -EINVAL
DAUC Cannot create subscriber: invalid IMSI: 'foobar123'

db_subscr_get_by_imsi(dbc, "foobar123", &g_subscr) --> -ENOEXEC
DAUC IMSI='foobar123': Error executing SQL: 101

db_subscr_create(dbc, "123") --> -EINVAL
DAUC Cannot create subscriber: invalid IMSI: '123'

db_subscr_get_by_imsi(dbc, "123", &g_subscr) --> -ENOEXEC
DAUC IMSI='123': Error executing SQL: 101

db_subscr_create(dbc, short_imsi) --> 0

db_subscr_get_by_imsi(dbc, short_imsi, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 4,
  .imsi = '123456',
}


--- Set valid / invalid MSISDN

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
}

db_subscr_update_msisdn_by_imsi(dbc, imsi0, "54321") --> 0

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
  .msisdn = '54321',
}

db_subscr_update_msisdn_by_imsi(dbc, imsi0, "54321012345678912345678") --> -EINVAL
DAUC IMSI='123456789000000': Cannot update subscriber: invalid MSISDN: '54321012345678912345678'

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
  .msisdn = '54321',
}

db_subscr_update_msisdn_by_imsi(dbc, imsi0, "543 21") --> -EINVAL
DAUC IMSI='123456789000000': Cannot update subscriber: invalid MSISDN: '543 21'

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
  .msisdn = '54321',
}

db_subscr_update_msisdn_by_imsi(dbc, imsi0, "foobar123") --> -EINVAL
DAUC IMSI='123456789000000': Cannot update subscriber: invalid MSISDN: 'foobar123'

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
  .msisdn = '54321',
}

db_subscr_update_msisdn_by_imsi(dbc, imsi0, "5") --> 0

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
  .msisdn = '5',
}

db_subscr_update_msisdn_by_imsi(dbc, imsi0, "543210123456789") --> 0

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
  .msisdn = '543210123456789',
}

db_subscr_update_msisdn_by_imsi(dbc, imsi0, "5432101234567891") --> -EINVAL
DAUC IMSI='123456789000000': Cannot update subscriber: invalid MSISDN: '5432101234567891'

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
  .msisdn = '543210123456789',
}


--- Set MSISDN on non-existent / invalid IMSI

db_subscr_update_msisdn_by_imsi(dbc, unknown_imsi, "99") --> -ENOENT
DAUC Cannot update MSISDN: no such subscriber: IMSI='999999999'

db_subscr_update_msisdn_by_imsi(dbc, "foobar", "99") --> -ENOENT
DAUC Cannot update MSISDN: no such subscriber: IMSI='foobar'


--- Delete non-existent / invalid IDs

db_subscr_delete_by_id(dbc, 999) --> -ENOENT
DAUC Cannot delete: no such subscriber: ID=999

db_subscr_delete_by_id(dbc, -10) --> -ENOENT
DAUC Cannot delete: no such subscriber: ID=-10


--- Delete subscribers

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 1,
  .imsi = '123456789000000',
  .msisdn = '543210123456789',
}

db_subscr_delete_by_id(dbc, id0) --> 0

db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> -ENOEXEC
DAUC IMSI='123456789000000': Error executing SQL: 101

db_subscr_delete_by_id(dbc, id0) --> -ENOENT
DAUC Cannot delete: no such subscriber: ID=1

db_subscr_get_by_imsi(dbc, imsi1, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 2,
  .imsi = '123456789000001',
}

db_subscr_delete_by_id(dbc, id1) --> 0

db_subscr_get_by_imsi(dbc, imsi1, &g_subscr) --> -ENOEXEC
DAUC IMSI='123456789000001': Error executing SQL: 101

db_subscr_get_by_imsi(dbc, imsi2, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 3,
  .imsi = '123456789000002',
}

db_subscr_delete_by_id(dbc, id2) --> 0

db_subscr_get_by_imsi(dbc, imsi2, &g_subscr) --> -ENOEXEC
DAUC IMSI='123456789000002': Error executing SQL: 101

db_subscr_get_by_imsi(dbc, short_imsi, &g_subscr) --> 0
struct hlr_subscriber {
  .id = 4,
  .imsi = '123456',
}

db_subscr_delete_by_id(dbc, id_short) --> 0

db_subscr_get_by_imsi(dbc, short_imsi, &g_subscr) --> -ENOEXEC
DAUC IMSI='123456': Error executing SQL: 101

===== test_subscr_create_update_sel_delete: SUCCESS