diff options
author | Oliver Smith <osmith@sysmocom.de> | 2019-03-06 13:49:05 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2019-05-13 08:55:24 +0200 |
commit | 6b73fd9678b5b4570edc3722fda467a82b3c7ccb (patch) | |
tree | 12f680906e5d7e6b14596c8eb1d8f0f95f2ae2d4 /tests | |
parent | cd2af5ead7a6fbba3e7b3df620536619a10ef356 (diff) |
db_hlr.c: add db_subscr_exists_by_imsi()
Check if a subscriber exists without generating an error log entry if
it does not. This is cheaper than db_subscr_get_by_imsi(), as it does
not fetch the subscriber entry. subscriber-create-on-demand will use
this function.
Related: OS#2542
Change-Id: I63818c0dd4fd22b41dadeeba2a07a651b5454c54
Diffstat (limited to 'tests')
-rw-r--r-- | tests/db/db_test.c | 4 | ||||
-rw-r--r-- | tests/db/db_test.err | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/db/db_test.c b/tests/db/db_test.c index 72feed4..217a8c5 100644 --- a/tests/db/db_test.c +++ b/tests/db/db_test.c @@ -256,6 +256,10 @@ static void test_subscr_create_update_sel_delete() ASSERT_SEL(imsi, short_imsi, 0); id_short = g_subscr.id; + comment("Check if subscriber exists (by IMSI)"); + + ASSERT_RC(db_subscr_exists_by_imsi(dbc, imsi0), 0); + ASSERT_RC(db_subscr_exists_by_imsi(dbc, unknown_imsi), -ENOENT); comment("Set valid / invalid MSISDN"); diff --git a/tests/db/db_test.err b/tests/db/db_test.err index 979562e..0701089 100644 --- a/tests/db/db_test.err +++ b/tests/db/db_test.err @@ -93,6 +93,13 @@ struct hlr_subscriber { } +--- Check if subscriber exists (by IMSI) + +db_subscr_exists_by_imsi(dbc, imsi0) --> 0 + +db_subscr_exists_by_imsi(dbc, unknown_imsi) --> -ENOENT + + --- Set valid / invalid MSISDN db_subscr_get_by_imsi(dbc, imsi0, &g_subscr) --> 0 |