#7949 test_integration/test_nfs.py fails at cleanup
Closed: fixed 4 months ago by fcami. Opened 7 months ago by sorlov.

Request for enhancement

As a quality engineer I would like to see test_integration/test_nfs.py passing

Issue

Test is failing with log:

self = <ipatests.test_integration.test_nfs.TestNFS object at 0x7f8074071990>

    def test_automount_location(self):
        """
            Test if ipa-client-automount behaves as expected
            """

        nfssrv = self.clients[0]
        automntclt = self.replicas[1]

        self.master.run_command([
            "ipa", "automountlocation-add", "seattle"
        ])
        self.master.run_command([
            "ipa", "automountmap-add", "seattle", "auto.home"
        ])
        self.master.run_command([
            "ipa", "automountkey-add", "seattle", "auto.home",
            "--key='*'", "--info=sec=krb5p,vers=4"
            " 'rhel8-nfsserver0.laptop.example.org:/export/home/&'"
        ])
        self.master.run_command([
            "ipa", "automountkey-add", "seattle", "auto.master",
            "--key=/home", "--info=auto.home"
        ])

        self.master.run_command([
            "ipa", "host-mod", automntclt.hostname,
            "--location", "seattle"
        ])

        # systemctl non-fatal errors will only be displayed
        # if ipa-client-automount is launched with --debug
        result1 = automntclt.run_command([
            'ipa-client-automount', '--location', 'seattle',
            '-U', '--debug'
        ])

        # systemctl non-fatal errors will show up like this:
        # stderr=Failed to restart nfs-secure.service: \
        #        Unit nfs-secure.service not found.
        # normal output:
        # stderr=
        m1 = re.search(r'(?<=stderr\=Failed).+', result1.stderr_text)
        # maybe re-use m1.group(0) if it exists.
        assert m1 is None

        time.sleep(WAIT_AFTER_INSTALL)

        automntclt.run_command([
            "mount", "-t", "nfs4", "-o", "sec=krb5p,vers=4.0",
            "%s:/exports/home" % nfssrv.hostname, "/home", "-v"
        ])

        automntclt.run_command(["umount", "-a", "-t", "nfs4"])

        result2 = automntclt.run_command([
            'ipa-client-automount', '--uninstall',
            '-U', '--debug'
        ])

        m2 = re.search(r'(?<=stderr\=Failed).+', result2.stderr_text)
        assert m2 is None

        time.sleep(WAIT_AFTER_UNINSTALL)
>       self.cleanup()

/usr/lib/python2.7/site-packages/ipatests/test_integration/test_nfs.py:260: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python2.7/site-packages/ipatests/test_integration/test_nfs.py:106: in cleanup
    self.restore_resolv_conf(client)
/usr/lib/python2.7/site-packages/ipatests/test_integration/test_nfs.py:55: in restore_resolv_conf
    paths.RESOLV_CONF
/usr/lib/python2.7/site-packages/pytest_multihost/host.py:251: in run_command
    command.wait(raiseonerr=raiseonerr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_multihost.transport.SSHCommand object at 0x7f807407ba50>
raiseonerr = True

    def wait(self, raiseonerr=True):
        """Wait for the remote process to exit

            Raises an excption if the exit code is not 0, unless raiseonerr is
            true.
            """
        if self._done:
            return self.returncode

        self._end_process()

        self._done = True

        if raiseonerr and self.returncode:
            self.log.error('Exit code: %s', self.returncode)
>           raise subprocess.CalledProcessError(self.returncode, self.argv)
E           CalledProcessError: Command '['/usr/bin/cp', '/etc/resolv.conf.sav', '/etc/resolv.conf']' returned non-zero exit status 1

/usr/lib/python2.7/site-packages/pytest_multihost/transport.py:159: CalledProcessError

Steps to reproduce:

  1. add line with ip address of ipa master to .etc/resolv.conf
  2. run test

Additional info:

This happens because in fix_resolv_conf() backup file is created only if resolv.conf needs to be patched, but in cleanup() it is restored unconditionally.

A good solution would be to use functions from shared library.


Metadata Update from @fcami:
- Issue assigned to fcami

5 months ago

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

5 months ago

master:

  • 21cd977 test_nfs.py: switch to tasks.config_replica_resolvconf_with_master_data()
  • 526b85a ipatests: rename config_replica_resolvconf_with_master_data()
  • 8056122 test_nfs.py: switch to master_3repl

ipa-4-8:

  • 68f98e2 test_nfs.py: switch to tasks.config_replica_resolvconf_with_master_data()
  • 0fdfce5 ipatests: rename config_replica_resolvconf_with_master_data()
  • 1ad3bf4 test_nfs.py: switch to master_3repl

ipa-4-7:

  • b79f8d8 test_nfs.py: switch to tasks.config_replica_resolvconf_with_master_data()
  • 912c38a ipatests: rename config_replica_resolvconf_with_master_data()
  • 98d3b63 test_nfs.py: switch to master_3repl

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

4 months ago

Login to comment on this ticket.

Metadata