diff options
author | Pavel Reichl <preichl@redhat.com> | 2015-07-08 09:01:24 -0400 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-07-24 09:30:41 +0200 |
commit | aa3fd6fde3888c0e333cad852ae5b4f671d55f58 (patch) | |
tree | b1b6f163577b2b596403ac54b76d2991d889cc23 /src/tests | |
parent | f91029dd8d7dbc026a5c73e222926db957240cb4 (diff) | |
download | sssd-aa3fd6fde3888c0e333cad852ae5b4f671d55f58.tar.gz sssd-aa3fd6fde3888c0e333cad852ae5b4f671d55f58.tar.xz sssd-aa3fd6fde3888c0e333cad852ae5b4f671d55f58.zip |
DYNDNS: sss_iface_addr_list_get return ENOENT
If none of eligible interfaces matches ifname then ENOENT is returned.
Resolves:
https://fedorahosted.org/sssd/ticket/2549
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/cmocka/test_dyndns.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tests/cmocka/test_dyndns.c b/src/tests/cmocka/test_dyndns.c index 689e333d4..3214e90c0 100644 --- a/src/tests/cmocka/test_dyndns.c +++ b/src/tests/cmocka/test_dyndns.c @@ -247,6 +247,23 @@ void dyndns_test_get_multi_ifaddr(void **state) assert_true(check_leaks_pop(dyndns_test_ctx) == true); } +void dyndns_test_get_ifaddr_enoent(void **state) +{ + errno_t ret; + struct sss_iface_addr *addrlist = NULL; + + check_leaks_push(dyndns_test_ctx); + will_return_getifaddrs("eth0", "192.168.0.1"); + will_return_getifaddrs("eth1", "192.168.0.2"); + will_return_getifaddrs(NULL, NULL); /* sentinel */ + ret = sss_iface_addr_list_get(dyndns_test_ctx, "non_existing_interface", + &addrlist); + assert_int_equal(ret, ENOENT); + talloc_free(addrlist); + + assert_true(check_leaks_pop(dyndns_test_ctx) == true); +} + void dyndns_test_ok(void **state) { struct tevent_req *req; @@ -460,6 +477,9 @@ int main(int argc, const char *argv[]) cmocka_unit_test_setup_teardown(dyndns_test_get_multi_ifaddr, dyndns_test_simple_setup, dyndns_test_teardown), + cmocka_unit_test_setup_teardown(dyndns_test_get_ifaddr_enoent, + dyndns_test_simple_setup, + dyndns_test_teardown), /* Dynamic DNS update unit tests*/ cmocka_unit_test_setup_teardown(dyndns_test_ok, |