summaryrefslogtreecommitdiffstats
path: root/src/tests/common_dom.c
Commit message (Collapse)AuthorAgeFilesLines
* TEST: create_multidom_test_ctx() extendingPetr Čech2017-02-081-3/+3
| | | | | | | | | | | | Function create_multidom_test_ctx() prepares test environment for multidomains. This patch enables setting of different params for each domain. Resolves: https://fedorahosted.org/sssd/ticket/3230 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com>
* SYSDB: Search the timestamp caches in addition to the sysdb cacheJakub Hrozek2016-06-231-6/+10
| | | | | | | | | | | | | | | When a sysdb entry is searched, the sysdb cache is consulted first for users or groups. If an entry is found in the sysdb cache, the attributes from the timestamp cache are merged to return the full and up-to-date set of attributes. The merging is done with a single BASE search which is a direct lookup into the underlying key-value database, so it should be relatively fast. More complex merging is done only for enumeration by filter which is currently done only via the IFP back end and should be quite infrequent, so I hope we can justify a more complex merging there. Reviewed-by: Sumit Bose <sbose@redhat.com>
* SYSDB: Open a timestamps cache for caching domainsJakub Hrozek2016-06-231-4/+30
| | | | | | | | | | | For all domain types, except the local domain, open a connection to a new ldb file located at /var/lib/sss/db names timestamps_$domain.ldb. Constructs the ldb file path manually in sysdb_check_upgrade_02() but that should be acceptable because nobody should be running such an old cache these days anyway. Reviewed-by: Sumit Bose <sbose@redhat.com>
* Remove braces from DEBUG statementsPavel Březina2016-06-181-2/+2
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* mock domain: reset ldb errorsPavel Březina2016-03-141-0/+4
| | | | | | | | | | | | | | | | | | After ldb connect ldb context contains the following error: "NULL Base DN invalid for a base search" This comes from internal ldb function ldb_set_default_dns() which runs base search on NULL dn to discover records similar to what rootDSE provides. However, tdb backend considers this an error and sets the message above. This may break memory leak checks in tests when we do push/pop on test_ctx which is a indirect parent of ldb_context. The error message is allocated when push is called but it is freed by other ldb queries and therefore not preset during the push phase and thus the leak check fails. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: Move named_domain from test_utils to common test codeJakub Hrozek2015-09-221-0/+22
| | | | | | This handy function should be reused by other parts of the code. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* tests: Move test_dom_suite_setup to different moduleLukas Slebodnik2015-09-181-13/+0
| | | | | | | | | | | The function test_dom_suite_setup is a simple function which creates a directory which should be used for creating files. This function needn't be linked with libsss_util.so as other functions in common_dom.c This is a reason why it's better to move it to the file common.c so linker can optimize out other unnecessary module objects from static library libsss_test_common.a and test needn't be linked libsss_util.so. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: remove code duplication in single domain cleanupPavel Březina2015-01-091-58/+12
| | | | Reviewed-by: Michal Židek <mzidek@redhat.com>
* tests: add test_multidom_suite_cleanup()Pavel Březina2015-01-091-0/+65
| | | | | | Cleanup multiple domains. Reviewed-by: Michal Židek <mzidek@redhat.com>
* tests: add create_multidom_test_ctx()Pavel Březina2015-01-091-21/+50
| | | | | | This will allow to create a multi domain test environment. Reviewed-by: Michal Židek <mzidek@redhat.com>
* tests: refactor create_dom_test_ctx()Pavel Březina2015-01-091-61/+193
| | | | | | | Separate the function into more functions as a preparation for creating a multi domain test environment. Reviewed-by: Michal Židek <mzidek@redhat.com>
* TESTS: Unit tests can use confdb without using sysdbJakub Hrozek2014-10-201-24/+28
| | | | | | | | | Previously, if a test used the utility functions for setting up a test, it had to use both sysdb and confdb. Some unit tests only need to use of of them, for example the unit tests for the server module only need confdb. Reviewed-by: Pavel Reichl <preichl@redhat.com>
* TESTS: Add confdb domain base DN to sss_test_ctxJakub Hrozek2014-07-011-0/+8
| | | | | | | | Creation of the path to the domain's confdb entry was duplicated in the tests. Rather than adding yet another duplication, I added the path as another field of the sss_test_ctx structure. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: Create a default sss_names_ctx in create_dom_test_ctxJakub Hrozek2014-04-221-0/+12
| | | | | | | | This would allow to call create_dom_test_ctx from tests that expect to be able to parse input with a regular expression just like a responder would do with an input from a client. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* TEST: Remove unused argument sysdb_pathLukas Slebodnik2014-03-121-1/+0
| | | | | | | | | Name of sysdb file is automatically generated from domain name and db_path in function sysdb_domain_init. talloc_asprintf is called with arguments "%s/cache_%s.ldb", db_path, dom->name Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: don't print debug message when test dir does not existPavel Březina2014-02-181-1/+1
| | | | | | | | We delete the test dir before a new test suit is started, to make sure there is no garbage left. The test dir is usually already deleted so in most runs a noisy debug message is printed. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: add confdb_path to sss_test_ctxPavel Březina2014-02-181-4/+4
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Make DEBUG macro invocations variadicNikolai Kondrashov2014-02-121-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; print $text;' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Fix dereference after a NULL check in tests.Lukas Slebodnik2013-06-101-6/+20
| | | | | | | https://fedorahosted.org/sssd/ticket/1972 Coverity IDs: 11870,11871 Do not call unlink with NULL pointer.
* Remove empty directories after tests run.Lukas Slebodnik2013-05-301-0/+8
| | | | | Empty directory tests_path is removed in function test_dom_suite_cleanup. Function test_dom_suite_cleanup is reused in other tests.
* Refactor dynamic DNS updatesJakub Hrozek2013-05-031-8/+1
| | | | | | | | | | | | Provides two new layers instead of the previous IPA specific layer: 1) dp_dyndns.c -- a very generic dyndns layer on the DP level. Its purpose it to make it possible for any back end to use dynamic DNS updates. 2) sdap_dyndns.c -- a wrapper around dp_dyndns.c that utilizes some LDAP-specific features like autodetecting the address from the LDAP connection. Also converts the dyndns code to new specific error codes.
* tests: Fix the order of key/valuesJakub Hrozek2013-04-181-2/+3
|
* Add utility functions for tests that use sysdb or tevent.Jakub Hrozek2013-03-081-0/+167
There was shared code for several unit tests that connected to their own sysdb instance. This patch adds common code to run a generic request to completion or connect to a test sysdb.