Blame SOURCES/0151-test_config_check-Fix-few-issues.patch

ecf709
From 15f997c22228f4b87a841148bf05c6911107879c Mon Sep 17 00:00:00 2001
ecf709
From: Lukas Slebodnik <lslebodn@redhat.com>
ecf709
Date: Wed, 31 May 2017 17:16:47 +0200
ecf709
Subject: [PATCH 151/152] test_config_check: Fix few issues
ecf709
MIME-Version: 1.0
ecf709
Content-Type: text/plain; charset=UTF-8
ecf709
Content-Transfer-Encoding: 8bit
ecf709
ecf709
* enable few tests
ecf709
* malformed configuration file due to missing closing ']'
ecf709
* fix few expected failures
ecf709
* add few sections into whitelist test
ecf709
* crash in test if count of expected failures is different then real
ecf709
  value
ecf709
ecf709
[ RUN      ] config_check_test_bad_subdom_option_name
ecf709
[rule/allowed_domain_options]: Attribute 'debug_leTYPOvel' is not allowed in section 'domain/A.test/B.A.test'. Check for typos.
ecf709
[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not allowed in section 'domain/A.test/B.A.test'. Check for typos.
ecf709
[  ERROR   ] --- Test failed with exception: Segmentation fault(11)
ecf709
ecf709
Reviewed-by: Michal Židek <mzidek@redhat.com>
ecf709
---
ecf709
 src/tests/cmocka/test_config_check.c | 14 ++++++++++----
ecf709
 1 file changed, 10 insertions(+), 4 deletions(-)
ecf709
ecf709
diff --git a/src/tests/cmocka/test_config_check.c b/src/tests/cmocka/test_config_check.c
ecf709
index bab3226c004fb9495471af7c7d3f6861552d8a86..0066ebe77e9f174449461caebdb3359380bc19b5 100644
ecf709
--- a/src/tests/cmocka/test_config_check.c
ecf709
+++ b/src/tests/cmocka/test_config_check.c
ecf709
@@ -81,6 +81,7 @@ void config_check_test_common(const char *cfg_string,
ecf709
         /* Keep this printf loop for faster debugging */
ecf709
         printf("%s\n", strs[i]);
ecf709
     }
ecf709
+    assert_int_equal(num_errors, num_errors_expected);
ecf709
 
ecf709
     for (int i = 0; i < num_errors && i <= num_errors_expected; i++) {
ecf709
         assert_string_equal(strs[i], errors_expected[i]);
ecf709
@@ -167,7 +168,7 @@ void config_check_test_bad_ifp_option_name(void **state)
ecf709
 
ecf709
 void config_check_test_bad_domain_option_name(void **state)
ecf709
 {
ecf709
-    char cfg_str[] = "[domain/A.test\n"
ecf709
+    char cfg_str[] = "[domain/A.test]\n"
ecf709
                      "debug_leTYPOvel = 10\n";
ecf709
     const char *expected_errors[] = {
ecf709
         "[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not "
ecf709
@@ -179,10 +180,10 @@ void config_check_test_bad_domain_option_name(void **state)
ecf709
 
ecf709
 void config_check_test_bad_appdomain_option_name(void **state)
ecf709
 {
ecf709
-    char cfg_str[] = "[application/myapp\n"
ecf709
+    char cfg_str[] = "[application/myapp]\n"
ecf709
                      "debug_leTYPOvel = 10\n";
ecf709
     const char *expected_errors[] = {
ecf709
-        "[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not "
ecf709
+        "[rule/allowed_domain_options]: Attribute 'debug_leTYPOvel' is not "
ecf709
         "allowed in section 'application/myapp'. Check for typos.",
ecf709
     };
ecf709
 
ecf709
@@ -194,7 +195,7 @@ void config_check_test_bad_subdom_option_name(void **state)
ecf709
     char cfg_str[] = "[domain/A.test/B.A.test]\n"
ecf709
                      "debug_leTYPOvel = 10\n";
ecf709
     const char *expected_errors[] = {
ecf709
-        "[rule/allowed_sssd_options]: Attribute 'debug_leTYPOvel' is not "
ecf709
+        "[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not "
ecf709
         "allowed in section 'domain/A.test/B.A.test'. Check for typos.",
ecf709
     };
ecf709
 
ecf709
@@ -210,6 +211,8 @@ void config_check_test_good_sections(void **state)
ecf709
                      "[domain/testdom.test/testsubdom.testdom.test]\n"
ecf709
                      "[application/myapp]\n"
ecf709
                      "[secrets]\n"
ecf709
+                     "[secrets/users/1000]\n"
ecf709
+                     "[ssh]\n"
ecf709
                      "[ifp]\n"
ecf709
                      "[pac]\n";
ecf709
     const char *expected_errors[] = { NULL };
ecf709
@@ -255,8 +258,11 @@ int main(int argc, const char *argv[])
ecf709
         cmocka_unit_test(config_check_test_bad_nss_option_name),
ecf709
         cmocka_unit_test(config_check_test_bad_pac_option_name),
ecf709
         cmocka_unit_test(config_check_test_bad_ifp_option_name),
ecf709
+        cmocka_unit_test(config_check_test_bad_appdomain_option_name),
ecf709
+        cmocka_unit_test(config_check_test_bad_subdom_option_name),
ecf709
         cmocka_unit_test(config_check_test_good_sections),
ecf709
         cmocka_unit_test(config_check_test_inherit_from_in_normal_dom),
ecf709
+        cmocka_unit_test(config_check_test_inherit_from_in_app_dom),
ecf709
     };
ecf709
 
ecf709
     /* Set debug level to invalid value so we can decide if -d 0 was used. */
ecf709
-- 
ecf709
2.9.4
ecf709