#9179 test_caless_TestServerCALessToExternalCA_RSN fails in teardown
Closed: fixed 2 years ago by frenaud. Opened 2 years ago by sumedhs.

test_caless_TestServerCALessToExternalCA_RSN falis in teardown. The teardown method is called even if all the tests are skipped since the required PKI version is not present.
The teardown is trying to remove a non-existent directory.

Solution:
to check if the directory to be removed exists before removing it.

    @classmethod
    def uninstall(cls, mh):
        # Remove the NSS database
        if cls.get('cert_dir'):
            shutil.rmtree(cls.cert_dir)
        super(CALessBase, cls).uninstall(mh)

PR
Report

cls = <class 'ipatests.test_integration.test_random_serial_numbers.TestServerCALessToExternalCA_RSN'>
mh = <pytest_multihost.plugin.MultihostFixture object at 0x7f637a8345b0>

    @classmethod
    def uninstall(cls, mh):
        # Remove the NSS database
>       shutil.rmtree(cls.cert_dir)
E       AttributeError: type object 'TestServerCALessToExternalCA_RSN' has no attribute 'cert_dir'

test_integration/test_caless.py:167: AttributeError
---------------------------- Captured log teardown -----------------------------
INFO     ipatests.pytest_ipa.integration:__init__.py:210 Collecting logs from: master.ipa.test
INFO     ipatests.pytest_ipa.integration.host.Host.master.IPAOpenSSHTransport:transport.py:391 RUN ['mktemp']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd16:transport.py:513 RUN ['mktemp']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd16:transport.py:557 /tmp/tmp.sQ7U4Z9NEe
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd16:transport.py:217 Exit code: 0
INFO     ipatests.pytest_ipa.integration.host.Host.master.IPAOpenSSHTransport:transport.py:391 RUN ['tar', 'cJvf', '/tmp/tmp.sQ7U4Z9NEe', '--ignore-failed-read', '--warning=no-failed-read', '--dereference', '/var/log/krb5kdc.log', '/var/log/ipaserver-install.log', '/var/log/ipa-custodia.audit.log', '/var/log/ipaserver-uninstall.log', '/var/log/ipareplica-install.log', '/var/log/ipaclientsamba-uninstall.log', '/etc/pki/pki-tomcat/alias', '/var/log/ipaclient-install.log', '/etc/pki/pki-tomcat/ca/CS.cfg', '/var/log/pki/', '/run/ipa/renewal.lock', '/etc/systemd/resolved.conf', '/etc/hosts', '/var/named/data/', '/etc/pki/pki-tomcat/server.xml', '/var/log/iparestore.log', '/etc/pki/pki-tomcat/kra/CS.cfg', '/var/log/httpd', '/var/log/ipaserver-adtrust-install.log', '/ipatests/env.sh', '/etc/resolv.conf', '/etc/NetworkManager/conf.d', '/var/log/ipatrust-enable-agent.log', '/etc/pki/pki-tomcat/alias/pwdfile.txt', '/var/log/letsencrypt/letsencrypt.log', '/var/log/dirsrv/', '/var/log/ipaclientsamba-install.log', '/etc/NetworkManager/NetworkManager.conf', '/var/log/kadmind.log', '/var/log/ipaclient-uninstall.log', '/var/log/ipabackup.log', '/var/log/ipaupgrade.log', '/var/log/ipareplica-ca-install.log', '/etc/systemd/resolved.conf.d', '/var/log/ipaepn.log', '/var/log/sssd', '/var/log/samba', '/var/log/ipareplica-conncheck.log', '/var/log/audit/audit.log', '/var/log/ipaserver-kra-install.log', '/var/log/ipaserver-dns-install.log']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd17:transport.py:513 RUN ['tar', 'cJvf', '/tmp/tmp.sQ7U4Z9NEe', '--ignore-failed-read', '--warning=no-failed-read', '--dereference', '/var/log/krb5kdc.log', '/var/log/ipaserver-install.log', '/var/log/ipa-custodia.audit.log', '/var/log/ipaserver-uninstall.log', '/var/log/ipareplica-install.log', '/var/log/ipaclientsamba-uninstall.log', '/etc/pki/pki-tomcat/alias', '/var/log/ipaclient-install.log', '/etc/pki/pki-tomcat/ca/CS.cfg', '/var/log/pki/', '/run/ipa/renewal.lock', '/etc/systemd/resolved.conf', '/etc/hosts', '/var/named/data/', '/etc/pki/pki-tomcat/server.xml', '/var/log/iparestore.log', '/etc/pki/pki-tomcat/kra/CS.cfg', '/var/log/httpd', '/var/log/ipaserver-adtrust-install.log', '/ipatests/env.sh', '/etc/resolv.conf', '/etc/NetworkManager/conf.d', '/var/log/ipatrust-enable-agent.log', '/etc/pki/pki-tomcat/alias/pwdfile.txt', '/var/log/letsencrypt/letsencrypt.log', '/var/log/dirsrv/', '/var/log/ipaclientsamba-install.log', '/etc/NetworkManager/NetworkManager.conf', '/var/log/kadmind.log', '/var/log/ipaclient-uninstall.log', '/var/log/ipabackup.log', '/var/log/ipaupgrade.log', '/var/log/ipareplica-ca-install.log', '/etc/systemd/resolved.conf.d', '/var/log/ipaepn.log', '/var/log/sssd', '/var/log/samba', '/var/log/ipareplica-conncheck.log', '/var/log/audit/audit.log', '/var/log/ipaserver-kra-install.log', '/var/log/ipaserver-dns-install.log']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd17:transport.py:557 tar: Removing leading `/' from member names
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd17:transport.py:557 tar: Removing leading `/' from hard link targets
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd17:transport.py:217 Exit code: 0
INFO     ipatests.pytest_ipa.integration.host.Host.master.IPAOpenSSHTransport:transport.py:436 GET /tmp/tmp.sQ7U4Z9NEe
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd18:transport.py:513 RUN ['cat', '/tmp/tmp.sQ7U4Z9NEe']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd18:transport.py:217 Exit code: 0
INFO     ipatests.pytest_ipa.integration.host.Host.master.IPAOpenSSHTransport:transport.py:391 RUN ['rm', '-f', '/tmp/tmp.sQ7U4Z9NEe']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd19:transport.py:513 RUN ['rm', '-f', '/tmp/tmp.sQ7U4Z9NEe']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd19:transport.py:217 Exit code: 0
INFO     ipatests.pytest_ipa.integration:__init__.py:166 Collecting journal from: master.ipa.test
INFO     ipatests.pytest_ipa.integration.host.Host.master.IPAOpenSSHTransport:transport.py:391 RUN ['journalctl', '--since', '-1h']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd20:transport.py:513 RUN ['journalctl', '--since', '-1h']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd20:transport.py:217 Exit code: 0

Metadata Update from @frenaud:
- Issue tagged with: test-failure, tests

2 years ago

Metadata Update from @frenaud:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/6312
- Issue assigned to sumedhs

2 years ago

Reproducible in testing_master_latest PR 1786 Report

Reproduced in testing_master_latest_selinux report

reproduced in testing_master_latest_selinux report

master:

  • 2e11247 Added a check while removing 'cert_dir'. The teardown method is called even if all the tests are skipped since the required PKI version is not present. The teardown is trying to remove a non-existent directory.

ipa-4-10:

  • aca9750 Added a check while removing 'cert_dir'. The teardown method is called even if all the tests are skipped since the required PKI version is not present. The teardown is trying to remove a non-existent directory.

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

2 years ago

Metadata Update from @frenaud:
- Issue set to the milestone: FreeIPA 4.10.1
- Issue status updated to: Open (was: Closed)

2 years ago

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

2 years ago

Login to comment on this ticket.

Metadata