5d90090676
- Resolves: RHEL-47294 SID generation task is failing when SELinux is in Enforcing mode - Resolves: RHEL-56472 Include latest fixes in python3-ipatests packages - Resolves: RHEL-56917 RFE add a tool to quickly detect and fix issues with IPA ID ranges - Resolves: RHEL-56965 Backport test fixes in python3-ipatests - Resolves: RHEL-58067 ipa replication installation fails in FIPS mode on rhel10 - Resolves: RHEL-59265 Default hbac rules are duplicated on remote server post ipa-migrate in prod-mode - Resolves: RHEL-59266 Also enable SSSD's ssh service when enabling sss_ssh_knownhosts Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
140 lines
5.0 KiB
Diff
140 lines
5.0 KiB
Diff
From d102773ce24481c6797f71557b75e77921164285 Mon Sep 17 00:00:00 2001
|
|
From: Stanislav Levin <slev@altlinux.org>
|
|
Date: Thu, 12 Sep 2024 12:38:52 +0300
|
|
Subject: [PATCH] ipatests: make TestDuplicates teardowns order agnostic
|
|
|
|
Fixtures 'user4' and 'user5' track the same actual user 'tuser'.
|
|
If used together their teardowns can fail depending on the
|
|
order of execution.
|
|
|
|
With this change fixtures of TestDuplicates are simplified and
|
|
method-scoped.
|
|
|
|
Related: https://pagure.io/freeipa/issue/9571
|
|
Signed-off-by: Stanislav Levin <slev@altlinux.org>
|
|
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
|
|
---
|
|
ipatests/test_xmlrpc/test_stageuser_plugin.py | 76 +++++++------------
|
|
1 file changed, 28 insertions(+), 48 deletions(-)
|
|
|
|
diff --git a/ipatests/test_xmlrpc/test_stageuser_plugin.py b/ipatests/test_xmlrpc/test_stageuser_plugin.py
|
|
index 9ae5561dfa4e0d54fe1231501bfea3c0ba261849..6ed593fbf24dd2e8ce087625b9cb4c21c9a3c145 100644
|
|
--- a/ipatests/test_xmlrpc/test_stageuser_plugin.py
|
|
+++ b/ipatests/test_xmlrpc/test_stageuser_plugin.py
|
|
@@ -120,12 +120,6 @@ def stageduser3(request, xmlrpc_setup):
|
|
return tracker.make_fixture_activate(request)
|
|
|
|
|
|
-@pytest.fixture(scope='class')
|
|
-def stageduser4(request, xmlrpc_setup):
|
|
- tracker = StageUserTracker(u'tuser', u'test', u'user')
|
|
- return tracker.make_fixture(request)
|
|
-
|
|
-
|
|
@pytest.fixture(scope='class')
|
|
def stageduser_notposix(request, xmlrpc_setup):
|
|
tracker = StageUserTracker(u'notposix', u'notposix', u'notposix')
|
|
@@ -161,18 +155,6 @@ def user3(request, xmlrpc_setup):
|
|
return tracker.make_fixture(request)
|
|
|
|
|
|
-@pytest.fixture(scope='class')
|
|
-def user4(request, xmlrpc_setup):
|
|
- tracker = UserTracker(u'tuser', u'test', u'user')
|
|
- return tracker.make_fixture(request)
|
|
-
|
|
-
|
|
-@pytest.fixture(scope='class')
|
|
-def user5(request, xmlrpc_setup):
|
|
- tracker = UserTracker(u'tuser', u'test', u'user')
|
|
- return tracker.make_fixture(request)
|
|
-
|
|
-
|
|
@pytest.fixture(scope='class')
|
|
def user6(request, xmlrpc_setup):
|
|
tracker = UserTracker(u'suser2', u'staged', u'user')
|
|
@@ -724,52 +706,50 @@ class TestManagers(XMLRPC_test):
|
|
|
|
@pytest.mark.tier1
|
|
class TestDuplicates(XMLRPC_test):
|
|
- def test_active_same_as_preserved(self, user4, user5):
|
|
- user4.ensure_missing()
|
|
- user5.make_preserved_user()
|
|
- command = user4.make_create_command()
|
|
+ @pytest.fixture
|
|
+ def user(self, request, xmlrpc_setup):
|
|
+ tracker = UserTracker("tuser", "test", "user")
|
|
+ return tracker.make_fixture(request)
|
|
+
|
|
+ @pytest.fixture
|
|
+ def stageduser(self, request, xmlrpc_setup):
|
|
+ tracker = StageUserTracker("tuser", "test", "user")
|
|
+ return tracker.make_fixture(request)
|
|
+
|
|
+ def test_active_same_as_preserved(self, user):
|
|
+ user.make_preserved_user()
|
|
+ command = user.make_create_command()
|
|
with raises_exact(errors.DuplicateEntry(
|
|
- message=u'user with name "%s" already exists' % user4.uid)):
|
|
+ message=u'user with name "%s" already exists' % user.uid)):
|
|
command()
|
|
- user5.delete()
|
|
|
|
- def test_staged_same_as_active(self, user4, stageduser4):
|
|
- user4.ensure_exists()
|
|
- stageduser4.create() # can be created
|
|
+ def test_staged_same_as_active(self, user, stageduser):
|
|
+ user.create()
|
|
+ stageduser.create() # can be created
|
|
|
|
- command = stageduser4.make_activate_command()
|
|
+ command = stageduser.make_activate_command()
|
|
with raises_exact(errors.DuplicateEntry(
|
|
message=u'active user with name "%s" already exists' %
|
|
- user4.uid)):
|
|
+ user.uid)):
|
|
command() # cannot be activated
|
|
|
|
- user4.delete()
|
|
- stageduser4.delete()
|
|
-
|
|
- def test_staged_same_as_preserved(self, user5, stageduser4):
|
|
- user5.make_preserved_user()
|
|
- stageduser4.create() # can be created
|
|
+ def test_staged_same_as_preserved(self, user, stageduser):
|
|
+ user.make_preserved_user()
|
|
+ stageduser.create() # can be created
|
|
|
|
- command = stageduser4.make_activate_command()
|
|
+ command = stageduser.make_activate_command()
|
|
with raises_exact(errors.DuplicateEntry(
|
|
message=u'This entry already exists')):
|
|
command() # cannot be activated
|
|
|
|
- user5.delete()
|
|
- stageduser4.delete()
|
|
+ def test_active_same_as_staged(self, user, stageduser):
|
|
+ stageduser.create()
|
|
+ user.create() # can be created
|
|
|
|
- def test_active_same_as_staged(self, user4, stageduser4):
|
|
- user4.ensure_missing()
|
|
- stageduser4.ensure_exists()
|
|
- command = user4.make_create_command()
|
|
- result = command()
|
|
- user4.track_create()
|
|
- user4.check_create(result) # can be created
|
|
-
|
|
- command = stageduser4.make_activate_command()
|
|
+ command = stageduser.make_activate_command()
|
|
with raises_exact(errors.DuplicateEntry(
|
|
message=u'active user with name "%s" already exists' %
|
|
- user4.uid)):
|
|
+ user.uid)):
|
|
command() # cannot be activated
|
|
|
|
|
|
--
|
|
2.46.0
|
|
|