Blame SOURCES/0049-intg-flush-the-SSSD-caches-to-sync-with-files.patch

71e593
From b24cc168b6244a9f215e2e235dbbcb3947da9280 Mon Sep 17 00:00:00 2001
71e593
From: Sumit Bose <sbose@redhat.com>
71e593
Date: Mon, 10 Sep 2018 15:35:45 +0200
71e593
Subject: [PATCH 49/57] intg: flush the SSSD caches to sync with files
71e593
71e593
To make sure that SSSD has synced with the latest data added to the
71e593
passwd file sss_cache is called in two places where the current sync
71e593
scheme was not reliable. This was mainly observed when running the
71e593
integration tests on Debian.
71e593
71e593
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
71e593
(cherry picked from commit 1e2398870e8aa512ead3012d46cbe6252429467a)
71e593
---
71e593
 src/tests/intg/test_files_provider.py | 8 ++++++++
71e593
 1 file changed, 8 insertions(+)
71e593
71e593
diff --git a/src/tests/intg/test_files_provider.py b/src/tests/intg/test_files_provider.py
71e593
index 9f30d2bb485cb4ccd14da2fa2317f62a7c347745..ead1cc4c34a8027f74f2a9564863159defce02ef 100644
71e593
--- a/src/tests/intg/test_files_provider.py
71e593
+++ b/src/tests/intg/test_files_provider.py
71e593
@@ -644,6 +644,10 @@ def test_enum_users(setup_pw_with_canary, files_domain_only):
71e593
         user = user_generator(i)
71e593
         setup_pw_with_canary.useradd(**user)
71e593
 
71e593
+    # syncing with the help of the canary is not reliable after adding
71e593
+    # multiple users because the canary might still be in some caches so that
71e593
+    # the data is not refreshed properly.
71e593
+    subprocess.call(["sss_cache", "-E"])
71e593
     sssd_getpwnam_sync(CANARY["name"])
71e593
     user_list = call_sssd_enumeration()
71e593
     # +1 because the canary is added
71e593
@@ -1043,6 +1047,10 @@ def test_getgrnam_add_remove_ghosts(setup_pw_with_canary,
71e593
 
71e593
     # Add this user and verify it's been added as a member
71e593
     pwd_ops.useradd(**USER2)
71e593
+    # The negative cache might still have user2 from the previous request,
71e593
+    # flushing the caches might help to prevent a failed lookup after adding
71e593
+    # the user.
71e593
+    subprocess.call(["sss_cache", "-E"])
71e593
     res, groups = sssd_id_sync('user2')
71e593
     assert res == sssd_id.NssReturnCode.SUCCESS
71e593
     assert len(groups) == 2
71e593
-- 
71e593
2.14.4
71e593