On 12/16/2014 11:49 AM, Tomas Babej wrote: > On 12/15/2014 11:32 AM, Tomas Babej wrote: >> Hi, >> >> Multihost object was is not passed to the install method in the super >> construction. >> This fixes setup errors in AD Trust, Forced client reenrollment, CALess >> and Sudo >> tests. >> >> https://fedorahosted.org/freeipa/ticket/4809 >> > Attaching updated patch, along with few related fixes. >
Upon further inspection, it seems I managed to miss two cases in the first patch. Fixed. > > > _______________________________________________ > Freeipa-devel mailing list > Freeipa-devel@redhat.com > https://www.redhat.com/mailman/listinfo/freeipa-devel -- Tomas Babej Associate Software Engineer | Red Hat | Identity Management RHCE | Brno Site | IRC: tbabej | freeipa.org
>From ba09e3f9252033b5fb44aaf07f43263733481822 Mon Sep 17 00:00:00 2001 From: Tomas Babej <tba...@redhat.com> Date: Mon, 15 Dec 2014 11:29:05 +0100 Subject: [PATCH] ipatests: Invoke class install methods properly with respect to pytest-multihost Multihost object was is not passed to the install method in the super construction. This fixes setup errors in AD Trust, Forced client reenrollment, CALess and Sudo tests. https://fedorahosted.org/freeipa/ticket/4809 --- ipatests/test_integration/test_caless.py | 6 +++--- ipatests/test_integration/test_forced_client_reenrollment.py | 2 +- ipatests/test_integration/test_legacy_clients.py | 8 ++++---- ipatests/test_integration/test_sudo.py | 8 ++++---- ipatests/test_integration/test_trust.py | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py index 426a4ad549e7f7cd1b35ab2da814f4c496a14762..9cfba3ee29114badf5a703ccc1d47a1d3e0c41b7 100644 --- a/ipatests/test_integration/test_caless.py +++ b/ipatests/test_integration/test_caless.py @@ -68,7 +68,7 @@ def assert_error(result, stderr_text, returncode=None): class CALessBase(IntegrationTest): @classmethod def install(cls, mh): - super(CALessBase, cls).install() + super(CALessBase, cls).install(mh) cls.cert_dir = tempfile.mkdtemp(prefix="ipatest-") cls.pem_filename = os.path.join(cls.cert_dir, 'root.pem') scriptfile = os.path.join(os.path.dirname(__file__), @@ -1145,8 +1145,8 @@ class TestClientInstall(CALessBase): class TestIPACommands(CALessBase): @classmethod - def install(cls): - super(TestIPACommands, cls).install() + def install(cls, mh): + super(TestIPACommands, cls).install(mh) cls.export_pkcs12('ca1/server') with open(cls.pem_filename, 'w') as f: diff --git a/ipatests/test_integration/test_forced_client_reenrollment.py b/ipatests/test_integration/test_forced_client_reenrollment.py index 709bc72c9037e4c37202ad91fce07ca4395f0bf6..ed9800d49f77f6f292f59c22509a9f568041200b 100644 --- a/ipatests/test_integration/test_forced_client_reenrollment.py +++ b/ipatests/test_integration/test_forced_client_reenrollment.py @@ -36,7 +36,7 @@ class TestForcedClientReenrollment(IntegrationTest): @classmethod def install(cls, mh): - super(TestForcedClientReenrollment, cls).install() + super(TestForcedClientReenrollment, cls).install(mh) tasks.install_master(cls.master) tasks.install_replica(cls.master, cls.replicas[0], setup_ca=False) cls.BACKUP_KEYTAB = os.path.join( diff --git a/ipatests/test_integration/test_legacy_clients.py b/ipatests/test_integration/test_legacy_clients.py index 49ad2801927bfffd36bd80e400173d5b86b3b856..68285643a3943053b047c197359ea6789c760990 100644 --- a/ipatests/test_integration/test_legacy_clients.py +++ b/ipatests/test_integration/test_legacy_clients.py @@ -320,8 +320,8 @@ class BaseTestLegacyClient(object): assert result.returncode != 0 @classmethod - def install(cls): - super(BaseTestLegacyClient, cls).install() + def install(cls, mh): + super(BaseTestLegacyClient, cls).install(mh) tasks.kinit_admin(cls.master) @@ -357,7 +357,7 @@ class BaseTestLegacyClient(object): tasks.backup_file(cls.legacy_client, f) @classmethod - def uninstall(cls): + def uninstall(cls, mh): cls.master.run_command(['ipa', 'user-del', 'disabledipauser'], raiseonerr=False) @@ -365,7 +365,7 @@ class BaseTestLegacyClient(object): if hasattr(cls, 'legacy_client'): tasks.unapply_fixes(cls.legacy_client) - super(BaseTestLegacyClient, cls).uninstall() + super(BaseTestLegacyClient, cls).uninstall(mh) # Base classes with attributes that are specific for each legacy client test diff --git a/ipatests/test_integration/test_sudo.py b/ipatests/test_integration/test_sudo.py index 38427a78808a316a385acf0fef5b3efdce415d07..1dd4c5d73c9fa4288af4fc2708aa3abd51407217 100644 --- a/ipatests/test_integration/test_sudo.py +++ b/ipatests/test_integration/test_sudo.py @@ -30,8 +30,8 @@ class TestSudo(IntegrationTest): topology = 'line' @classmethod - def install(cls): - super(TestSudo, cls).install() + def install(cls, mh): + super(TestSudo, cls).install(mh) cls.client = cls.clients[0] @@ -70,10 +70,10 @@ class TestSudo(IntegrationTest): 'localuser']) @classmethod - def uninstall(cls): + def uninstall(cls, mh): cls.client.run_command(['groupdel', 'localgroup'], raiseonerr=False) cls.client.run_command(['userdel', 'localuser'], raiseonerr=False) - super(TestSudo, cls).uninstall() + super(TestSudo, cls).uninstall(mh) def list_sudo_commands(self, user, raiseonerr=False, verbose=False): clear_sssd_cache(self.client) diff --git a/ipatests/test_integration/test_trust.py b/ipatests/test_integration/test_trust.py index 9a7ab2948673b104c009a192be0ced974ac30e1a..772a50842f7c251b78d68fd4bd3c91668f580d50 100644 --- a/ipatests/test_integration/test_trust.py +++ b/ipatests/test_integration/test_trust.py @@ -34,7 +34,7 @@ class ADTrustBase(IntegrationTest): @classmethod def install(cls, mh): - super(ADTrustBase, cls).install() + super(ADTrustBase, cls).install(mh) cls.ad = cls.ad_domains[0].ads[0] cls.install_adtrust() cls.check_sid_generation() -- 1.9.3
>From fafa996cf1a76d53cae99a34deb3012bbb5a9f35 Mon Sep 17 00:00:00 2001 From: Tomas Babej <tba...@redhat.com> Date: Mon, 15 Dec 2014 18:42:45 +0100 Subject: [PATCH] ipatests: Refactor and fix docstrings in integration pytest plugin https://fedorahosted.org/freeipa/ticket/4809 --- ipatests/pytest_plugins/integration.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ipatests/pytest_plugins/integration.py b/ipatests/pytest_plugins/integration.py index 3bd9d6e05620fd18035eab9decf4de378a8922c2..1dddf5b8c746b5b57452cac91559b9517f895911 100644 --- a/ipatests/pytest_plugins/integration.py +++ b/ipatests/pytest_plugins/integration.py @@ -179,7 +179,7 @@ def mh(request, class_integration_logs): config_class=Config, _config=get_global_config(), ) - config = mh.config + mh.domain = mh.config.domains[0] [mh.master] = mh.domain.hosts_by_role('master') mh.replicas = mh.domain.hosts_by_role('replica') @@ -192,13 +192,13 @@ def mh(request, class_integration_logs): (host.external_hostname, filename)) class_integration_logs.setdefault(host, []).append(filename) - print config - for host in config.get_all_hosts(): + print mh.config + for host in mh.config.get_all_hosts(): host.add_log_collector(collect_log) cls.log.info('Preparing host %s', host.hostname) tasks.prepare_host(host) - setup_class(cls, config) + setup_class(cls, mh) mh._pytestmh_request.addfinalizer(lambda: teardown_class(cls)) yield mh.install() @@ -209,21 +209,21 @@ def mh(request, class_integration_logs): collect_test_logs(request.node, class_integration_logs, request.config) -def setup_class(cls, config): - """Add convenience addributes to the test class +def setup_class(cls, mh): + """Add convenience attributes to the test class This is deprecated in favor of the mh fixture. To be removed when no more tests using this. """ - cls.domain = config.domains[0] - cls.master = cls.domain.master - cls.replicas = cls.domain.replicas - cls.clients = cls.domain.clients - cls.ad_domains = config.ad_domains + cls.domain = mh.domain + cls.master = mh.master + cls.replicas = mh.replicas + cls.clients = mh.clients + cls.ad_domains = mh.config.ad_domains def teardown_class(cls): - """Add convenience addributes to the test class + """Remove convenience attributes from the test class This is deprecated in favor of the mh fixture. To be removed when no more tests using this. -- 1.9.3
>From 3e21ffb926e713cb206bd42530e0b0eb9f0801f3 Mon Sep 17 00:00:00 2001 From: Tomas Babej <tba...@redhat.com> Date: Mon, 15 Dec 2014 17:11:40 +0100 Subject: [PATCH] ipatests: Set the correct number of required clients for IntegrationTest Remove the copy-pate error that used number of required replicas instead. https://fedorahosted.org/freeipa/ticket/4809 --- ipatests/pytest_plugins/integration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipatests/pytest_plugins/integration.py b/ipatests/pytest_plugins/integration.py index a6c09518ff4602d31eb37a9cbc27be3ae752ea29..3bd9d6e05620fd18035eab9decf4de378a8922c2 100644 --- a/ipatests/pytest_plugins/integration.py +++ b/ipatests/pytest_plugins/integration.py @@ -160,7 +160,7 @@ def mh(request, class_integration_logs): 'hosts': { 'master': 1, 'replica': cls.num_replicas, - 'client': cls.num_replicas, + 'client': cls.num_clients, }, } domain_description['hosts'].update( -- 1.9.3
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel