URL: https://github.com/freeipa/freeipa/pull/4547
Author: tjaalton
 Title: #4547: Fixes to allow running the testsuite on Debian/Ubuntu
Action: opened

PR body:
"""
These make running the testsuite on azure easier, and while it's not fully 
there yet, this bunch should be safe to apply upstream.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/4547/head:pr4547
git checkout pr4547
From 31fc707fdb265526846f7628d7b1cda742097972 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Mon, 6 Apr 2020 13:33:59 +0300
Subject: [PATCH 01/10] test_advise.py: Use bash for advice_regex.

---
 ipatests/test_integration/test_advise.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipatests/test_integration/test_advise.py b/ipatests/test_integration/test_advise.py
index fbd6aadb1f..fe13b66542 100644
--- a/ipatests/test_integration/test_advise.py
+++ b/ipatests/test_integration/test_advise.py
@@ -141,7 +141,7 @@ def test_advice_enable_admins_sudo(self):
 
     def test_advice_config_server_for_smart_card_auth(self):
         advice_id = 'config_server_for_smart_card_auth'
-        advice_regex = r"\#\!\/bin\/sh.*"
+        advice_regex = r"\#\!\/bin\/bash.*"
         run_advice(self.master, advice_id, advice_regex)
 
         ca_pem = ExternalCA().create_ca()
@@ -163,7 +163,7 @@ def test_advice_config_server_for_smart_card_auth(self):
 
     def test_advice_config_client_for_smart_card_auth(self):
         advice_id = 'config_client_for_smart_card_auth'
-        advice_regex = r"\#\!\/bin\/sh.*"
+        advice_regex = r"\#\!\/bin\/bash.*"
         run_advice(self.master, advice_id, advice_regex)
 
         client = self.clients[0]

From 659a814a81d9a343f3491274b15eb0b86497c477 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Fri, 3 Apr 2020 07:40:45 +0300
Subject: [PATCH 02/10] Debian: Use enable/disable_ldap_automount() from base

---
 ipaplatform/debian/tasks.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ipaplatform/debian/tasks.py b/ipaplatform/debian/tasks.py
index 025c5d12d9..4d103e9fb3 100644
--- a/ipaplatform/debian/tasks.py
+++ b/ipaplatform/debian/tasks.py
@@ -206,4 +206,10 @@ def remove_ca_certificates_dir(self, directory):
 
         return True
 
+    def enable_ldap_automount(self, statestore):
+        return BaseTaskNamespace.enable_ldap_automount(self, statestore)
+
+    def disable_ldap_automount(self, statestore):
+        return BaseTaskNamespace.disable_ldap_automount(self, statestore)
+
 tasks = DebianTaskNamespace()

From dbcb708f37d6a33cfdc42b5176807c1b51002147 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Thu, 16 Apr 2020 20:18:52 +0300
Subject: [PATCH 03/10] Debian: Use parse_ipa_version from redhat.

Needs librpm8 installed.
---
 ipaplatform/debian/tasks.py | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/ipaplatform/debian/tasks.py b/ipaplatform/debian/tasks.py
index 4d103e9fb3..54480f919b 100644
--- a/ipaplatform/debian/tasks.py
+++ b/ipaplatform/debian/tasks.py
@@ -72,10 +72,6 @@ def migrate_auth_configuration(self, statestore):
         # Debian doesn't have authselect
         return True
 
-    @staticmethod
-    def parse_ipa_version(version):
-        return BaseTaskNamespace.parse_ipa_version(version)
-
     def configure_httpd_wsgi_conf(self):
         # Debian doesn't require special mod_wsgi configuration
         pass

From 4943d51ddd36cdbafe7b24e5a0e0fa30243680b4 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Thu, 16 Apr 2020 20:21:01 +0300
Subject: [PATCH 04/10] ipaplatform: Add a symlink ubuntu -> debian.

Allows running tests on Ubuntu.
---
 ipaplatform/ubuntu | 1 +
 1 file changed, 1 insertion(+)
 create mode 120000 ipaplatform/ubuntu

diff --git a/ipaplatform/ubuntu b/ipaplatform/ubuntu
new file mode 120000
index 0000000000..b2f7fd3e91
--- /dev/null
+++ b/ipaplatform/ubuntu
@@ -0,0 +1 @@
+debian
\ No newline at end of file

From 30ec7fceb87865dc940c51f1f40c096d87910f35 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Fri, 17 Apr 2020 13:16:25 +0300
Subject: [PATCH 05/10] ipa-run-tests: Use bash.

---
 ipatests/ipa-run-tests | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipatests/ipa-run-tests b/ipatests/ipa-run-tests
index c01a391153..e23fa4f365 100755
--- a/ipatests/ipa-run-tests
+++ b/ipatests/ipa-run-tests
@@ -59,7 +59,7 @@ if not has_option("cache_dir"):
 pyt_args = [sys.executable, "-c",
             "import sys,pytest;sys.exit(pytest.main())"] + sys.argv[1:]
 # shell is needed to perform globbing
-sh_args = ["/bin/sh", "--norc", "--noprofile", "-c", "--"]
+sh_args = ["/bin/bash", "--norc", "--noprofile", "-c", "--"]
 pyt_args_esc = [
     f"'{x}'" if not x or " " in x else x
     for x in pyt_args

From fa84cbaf2bc29b2086c4f65052d609bc59bcaebf Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Fri, 17 Apr 2020 13:21:36 +0300
Subject: [PATCH 06/10] ipatests/test_commands: Check sssd version like on
 test_sssd

---
 ipatests/test_integration/test_commands.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py
index 7bb1ebcab5..d38979ae62 100644
--- a/ipatests/test_integration/test_commands.py
+++ b/ipatests/test_integration/test_commands.py
@@ -884,11 +884,10 @@ def test_ssh_from_controller(self):
         if self.master.is_fips_mode:  # pylint: disable=no-member
             pytest.skip("paramiko is not compatible with FIPS mode")
 
-        sssd_version = ''
-        cmd_output = self.master.run_command(['sssd', '--version'])
-        sssd_version = platform_tasks.\
-            parse_ipa_version(cmd_output.stdout_text.strip())
-        if sssd_version.version < '2.2.0':
+        cmd = self.master.run_command(['sssd', '--version'])
+        sssd_version = platform_tasks.parse_ipa_version(
+            cmd.stdout_text.strip())
+        if sssd_version <= platform_tasks.parse_ipa_version('2.2.0'):
             pytest.xfail(reason="sssd 2.2.0 unavailable in F29 nightly")
 
         username = "testuser" + str(random.randint(200000, 9999999))

From 82a1b9b990cd3b3ed6763b72094bda1f6ca7b4cd Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Fri, 17 Apr 2020 13:25:41 +0300
Subject: [PATCH 07/10] ipatests: Skip tests on Debian that require crypto
 policy.

---
 ipatests/test_integration/test_commands.py | 5 +++++
 ipatests/test_ipalib/test_util.py          | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py
index d38979ae62..cebb652f0d 100644
--- a/ipatests/test_integration/test_commands.py
+++ b/ipatests/test_integration/test_commands.py
@@ -32,6 +32,7 @@
 from ipatests.test_integration.base import IntegrationTest
 
 from ipatests.pytest_ipa.integration import tasks
+from ipaplatform.osinfo import osinfo
 from ipaplatform.tasks import tasks as platform_tasks
 from ipatests.create_external_ca import ExternalCA
 from ipatests.test_ipalib.test_x509 import good_pkcs7, badcert
@@ -966,6 +967,10 @@ def test_enabled_tls_protocols(self):
         This is the regression test for issue
         https://pagure.io/freeipa/issue/7995.
         """
+
+        if osinfo.platform in ('debian'):
+            pytest.skip("Crypto policy is not supported on Debian")
+
         def is_tls_version_enabled(tls_version):
             res = self.master.run_command(
                 ['openssl', 's_client',
diff --git a/ipatests/test_ipalib/test_util.py b/ipatests/test_ipalib/test_util.py
index d1815c0c8d..7002cedee8 100644
--- a/ipatests/test_ipalib/test_util.py
+++ b/ipatests/test_ipalib/test_util.py
@@ -14,6 +14,7 @@
     get_pager, create_https_connection, get_proper_tls_version_span
 )
 from ipaplatform.constants import constants
+from ipaplatform.osinfo import osinfo
 
 
 @pytest.mark.parametrize('pager,expected_result', [
@@ -60,6 +61,9 @@ def test_get_pager(pager, expected_result):
     ("tls1.3", None, BASE_OPT | TLS_OPT | ssl.OP_NO_TLSv1_2, ["tls1.3"]),
 ])
 def test_tls_version_span(minver, maxver, opt, expected):
+    if osinfo.platform in ('debian'):
+        pytest.skip("Crypto policy is not supported on Debian")
+
     assert get_proper_tls_version_span(minver, maxver) == expected
     # file must exist and contain certs
     cafile = ssl.get_default_verify_paths().cafile

From 1262a79cb76dc4e5aa50e7a17fe497ea7bb58f3a Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Fri, 17 Apr 2020 13:37:28 +0300
Subject: [PATCH 08/10] ipatests/test_installation: Use knownservices to map
 the service name.

---
 ipatests/test_integration/test_installation.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
index d8fad7e061..8546d52cc2 100644
--- a/ipatests/test_integration/test_installation.py
+++ b/ipatests/test_integration/test_installation.py
@@ -607,24 +607,25 @@ def test_ipactl_scenario_check(self):
         other hand in case of restart it will change.
         """
         # listing all services
-        services = [
+        ipa_services_name = [
             "Directory", "krb5kdc", "kadmin", "named", "httpd", "ipa-custodia",
             "pki-tomcatd", "ipa-otpd", "ipa-dnskeysyncd"
         ]
 
         # checking the service status
         cmd = self.master.run_command(['ipactl', 'status'])
-        for service in services:
+        for service in ipa_services_name:
             assert f"{service} Service: RUNNING" in cmd.stdout_text
 
         # stopping few services
         service_stop = ["krb5kdc", "kadmin", "httpd"]
         for service in service_stop:
-            self.master.run_command(['systemctl', 'stop', service])
+            service_name = services.knownservices[service].systemd_name
+            self.master.run_command(['systemctl', 'stop', service_name])
 
         # checking service status
         service_start = [
-            svcs for svcs in services if svcs not in service_stop
+            svcs for svcs in ipa_services_name if svcs not in service_stop
         ]
         cmd = self.master.run_command(['ipactl', 'status'])
         for service in service_start:
@@ -637,7 +638,7 @@ def test_ipactl_scenario_check(self):
 
         # checking service status
         cmd = self.master.run_command(['ipactl', 'status'])
-        for service in services:
+        for service in ipa_services_name:
             assert f"{service} Service: RUNNING" in cmd.stdout_text
 
         # get process id of services
@@ -648,7 +649,7 @@ def test_ipactl_scenario_check(self):
 
         # checking service status
         cmd = self.master.run_command(['ipactl', 'status'])
-        for service in services:
+        for service in ipa_services_name:
             assert f"{service} Service: RUNNING" in cmd.stdout_text
 
         # check if pid for services are different
@@ -660,7 +661,7 @@ def test_ipactl_scenario_check(self):
 
         # checking service status
         cmd = self.master.run_command(['ipactl', 'status'])
-        for service in services:
+        for service in ipa_services_name:
             assert f"{service} Service: RUNNING" in cmd.stdout_text
 
         # check if pid for services are same

From 338d328a5bc88782223cdebadc4d10782dde1f79 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Fri, 17 Apr 2020 14:19:24 +0300
Subject: [PATCH 09/10] ipatests/test_sudo: NISDOMAIN has not been set on
 Debian, so the test would fail.

---
 ipatests/test_integration/test_sudo.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ipatests/test_integration/test_sudo.py b/ipatests/test_integration/test_sudo.py
index 031635135f..2f65c28c81 100644
--- a/ipatests/test_integration/test_sudo.py
+++ b/ipatests/test_integration/test_sudo.py
@@ -19,6 +19,7 @@
 
 import pytest
 
+from ipaplatform.osinfo import osinfo
 from ipaplatform.paths import paths
 
 from ipatests.test_integration.base import IntegrationTest
@@ -153,6 +154,8 @@ def test_advise_script_enable_sudo_admins(self):
                 'rules cleanup failed'
 
     def test_nisdomainname(self):
+        if osinfo.platform in ('debian'):
+            pytest.skip("NISDOMAIN has not been set on Debian")
         result = self.client.run_command('nisdomainname')
         assert self.client.domain.name in result.stdout_text
 

From 5a8f2baf0095189dbed807772bc6ef99fcad8a3a Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Thu, 16 Apr 2020 22:25:18 +0300
Subject: [PATCH 10/10] Debian: Fix path to bind defaults file.

This is from the 9.16 packaging, and while IPA does not work with it
yet, this allows testing against preliminary packages.
---
 ipaplatform/debian/paths.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipaplatform/debian/paths.py b/ipaplatform/debian/paths.py
index 40d71334d3..8347fe3805 100644
--- a/ipaplatform/debian/paths.py
+++ b/ipaplatform/debian/paths.py
@@ -58,7 +58,7 @@ class DebianPathNamespace(BasePathNamespace):
     SYSCONFIG_IPA_DNSKEYSYNCD = "/etc/default/ipa-dnskeysyncd"
     SYSCONFIG_IPA_ODS_EXPORTER = "/etc/default/ipa-ods-exporter"
     SYSCONFIG_KRB5KDC_DIR = "/etc/default/krb5-kdc"
-    SYSCONFIG_NAMED = "/etc/default/bind9"
+    SYSCONFIG_NAMED = "/etc/default/named"
     SYSCONFIG_NFS = "/etc/default/nfs-common"
     SYSCONFIG_NTPD = "/etc/default/ntp"
     SYSCONFIG_ODS = "/etc/default/opendnssec"
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to