[SSSD] [PATCH] SYSDB: Abort unit test if sysdb_getpwnam fails

Jakub Hrozek jhrozek at redhat.com
Tue Sep 4 21:35:55 UTC 2012


This is technically only an error condition but we hit it when we broke
sysdb_store_user()

I'm glad we have unit tests now..
-------------- next part --------------
>From 60f2a286746b7ba46f7b38217bf5defc98d75123 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 4 Sep 2012 23:29:22 +0200
Subject: [PATCH] SYSDB: Abort unit test if sysdb_getpwnam fails

---
 src/tests/sysdb-tests.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index d314baa9579b91fd884a104dc900fc56a590a268..be86f846a03de04322a569245502862fcc7f3ae2 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -912,6 +912,9 @@ START_TEST (test_sysdb_getpwuid)
         goto done;
     }
 
+    fail_unless(res->count == 1, "Expected 1 user entry, found %d\n",
+                res->count);
+
     username = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_NAME, 0);
 
     e_username = talloc_asprintf(test_ctx, "testuser%d", _i);
-- 
1.7.11.4



More information about the sssd-devel mailing list