#9871 test_http_kdc_proxy.py::TestHttpKdcProxy failure during its setup
Closed: fixed by frenaud. Opened by frenaud.

Issue

The test test_http_kdc_proxy.py::TestHttpKdcProxy needs to be adapted because the kerberos client configuration is now shipped in a snippet /etc/krb5.conf.d/freeipa-realm instead of /etc/krb5.conf (after commit https://github.com/freeipa/freeipa/commit/890474ae3c48eec1aca180fc1db0613e67572a85).

Test scenario: the test edits the kdc value from the config file and replaces with kdc = https://master.ufreeipa.test/KdcProxy in order to use a KDC proxy.

Steps to Reproduce

  1. Launche the test test_integration/test_http_kdc_proxy.py::TestHttpKdcProxy

Actual behavior

The test fails to find the setting kdc = in the file /etc/krb5.conf:

self = <ipatests.test_integration.test_http_kdc_proxy.TestHttpKdcProxy object at 0x7f8e8c0a05f0>
mh = <pytest_multihost.plugin.MultihostFixture object at 0x7f8e8c26e660>
    @pytest.fixture()
    def client_use_kdcproxy(self, mh):
        """Configure client for using kdcproxy for IPA and AD domains."""
        def replace_regexp_once(pattern, repl, string):
            res, n = re.subn(pattern, repl, string)
            assert n == 1
            return res
        krb5conf_backup = tasks.FileBackup(self.client, paths.KRB5_CONF)
        krb5conf = self.client.get_file_contents(
            paths.KRB5_CONF, encoding='utf-8')
        kdc_url = 'https://{}/KdcProxy'.format(self.master.hostname)
        # configure kdc proxy for IPA realm
>       krb5conf = replace_regexp_once(
            r' kdc = .+', ' kdc = {}'.format(kdc_url), krb5conf)
kdc_url    = 'https://master.ufreeipa.test/KdcProxy'
krb5conf   = '#File modified by ipa-client-install\n\nincludedir /etc/krb5.conf.d/\n[libdefaults]\n  default_realm = UFREEIPA.TEST\...etime = 24h\n  forwardable = true\n  udp_preference_limit = 0\n  default_ccache_name = KEYRING:persistent:%{uid}\n\n\n'
krb5conf_backup = <ipatests.pytest_ipa.integration.tasks.FileBackup object at 0x7f8e8c26e270>
mh         = <pytest_multihost.plugin.MultihostFixture object at 0x7f8e8c26e660>
replace_regexp_once = <function TestHttpKdcProxy.client_use_kdcproxy.<locals>.replace_regexp_once at 0x7f8e8ad1bba0>
self       = <ipatests.test_integration.test_http_kdc_proxy.TestHttpKdcProxy object at 0x7f8e8c0a05f0>
test_integration/test_http_kdc_proxy.py:103: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pattern = ' kdc = .+', repl = ' kdc = https://master.ufreeipa.test/KdcProxy'
string = '#File modified by ipa-client-install\n\nincludedir /etc/krb5.conf.d/\n[libdefaults]\n  default_realm = UFREEIPA.TEST\...etime = 24h\n  forwardable = true\n  udp_preference_limit = 0\n  default_ccache_name = KEYRING:persistent:%{uid}\n\n\n'
    def replace_regexp_once(pattern, repl, string):
        res, n = re.subn(pattern, repl, string)
>       assert n == 1
E       assert 0 == 1
n          = 0
pattern    = ' kdc = .+'
repl       = ' kdc = https://master.ufreeipa.test/KdcProxy'
res        = '#File modified by ipa-client-install\n\nincludedir /etc/krb5.conf.d/\n[libdefaults]\n  default_realm = UFREEIPA.TEST\...etime = 24h\n  forwardable = true\n  udp_preference_limit = 0\n  default_ccache_name = KEYRING:persistent:%{uid}\n\n\n'
string     = '#File modified by ipa-client-install\n\nincludedir /etc/krb5.conf.d/\n[libdefaults]\n  default_realm = UFREEIPA.TEST\...etime = 24h\n  forwardable = true\n  udp_preference_limit = 0\n  default_ccache_name = KEYRING:persistent:%{uid}\n\n\n'
test_integration/test_http_kdc_proxy.py:94: AssertionError

We need to fix the test and edit the snippet file instead.


Metadata Update from @frenaud:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/8009

master:

  • 0ff5d6a388912bc0a3645de4a57b5ab228652ff4 TestHttpKdcProxy: use the snippet file for krb5 config

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata