mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipatests: check that ipa-client-automount restores nsswitch.conf at uninstall time
Check that using ipa-client-install, ipa-client-automount --no-ssd, then uninstalling both properly restores nsswitch.conf sequentially. Related-to:: https://pagure.io/freeipa/issue/8038 Signed-off-by: François Cami <fcami@redhat.com> Reviewed-By: Francois Cami <fcami@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
parent
a71c59c7c8
commit
405dcc6bec
@ -1257,6 +1257,18 @@ jobs:
|
|||||||
timeout: 9000
|
timeout: 9000
|
||||||
topology: *master_3client
|
topology: *master_3client
|
||||||
|
|
||||||
|
fedora-29/nfs_nsswitch_restore:
|
||||||
|
requires: [fedora-29/build]
|
||||||
|
priority: 50
|
||||||
|
job:
|
||||||
|
class: RunPytest
|
||||||
|
args:
|
||||||
|
build_url: '{fedora-29/build_url}'
|
||||||
|
test_suite: test_integration/test_nfs.py::TestIpaClientAutomountFileRestore
|
||||||
|
template: *ci-master-f29
|
||||||
|
timeout: 3600
|
||||||
|
topology: *master_3client
|
||||||
|
|
||||||
fedora-29/mask:
|
fedora-29/mask:
|
||||||
requires: [fedora-29/build]
|
requires: [fedora-29/build]
|
||||||
priority: 50
|
priority: 50
|
||||||
|
@ -1257,6 +1257,18 @@ jobs:
|
|||||||
timeout: 9000
|
timeout: 9000
|
||||||
topology: *master_3client
|
topology: *master_3client
|
||||||
|
|
||||||
|
fedora-30/nfs_nsswitch_restore:
|
||||||
|
requires: [fedora-30/build]
|
||||||
|
priority: 50
|
||||||
|
job:
|
||||||
|
class: RunPytest
|
||||||
|
args:
|
||||||
|
build_url: '{fedora-30/build_url}'
|
||||||
|
test_suite: test_integration/test_nfs.py::TestIpaClientAutomountFileRestore
|
||||||
|
template: *ci-master-f30
|
||||||
|
timeout: 3600
|
||||||
|
topology: *master_3client
|
||||||
|
|
||||||
fedora-30/mask:
|
fedora-30/mask:
|
||||||
requires: [fedora-30/build]
|
requires: [fedora-30/build]
|
||||||
priority: 50
|
priority: 50
|
||||||
|
@ -1269,6 +1269,18 @@ jobs:
|
|||||||
timeout: 9000
|
timeout: 9000
|
||||||
topology: *master_3client
|
topology: *master_3client
|
||||||
|
|
||||||
|
fedora-rawhide/nfs_nsswitch_restore:
|
||||||
|
requires: [fedora-rawhide/build]
|
||||||
|
priority: 50
|
||||||
|
job:
|
||||||
|
class: RunPytest
|
||||||
|
args:
|
||||||
|
build_url: '{fedora-rawhide/build_url}'
|
||||||
|
test_suite: test_integration/test_nfs.py::TestIpaClientAutomountFileRestore
|
||||||
|
template: *ci-master-frawhide
|
||||||
|
timeout: 9000
|
||||||
|
topology: *master_3client
|
||||||
|
|
||||||
fedora-rawhide/automember:
|
fedora-rawhide/automember:
|
||||||
requires: [fedora-rawhide/build]
|
requires: [fedora-rawhide/build]
|
||||||
priority: 50
|
priority: 50
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
import pytest
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
@ -258,3 +259,74 @@ class TestNFS(IntegrationTest):
|
|||||||
time.sleep(WAIT_AFTER_UNINSTALL)
|
time.sleep(WAIT_AFTER_UNINSTALL)
|
||||||
|
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
|
||||||
|
|
||||||
|
class TestIpaClientAutomountFileRestore(IntegrationTest):
|
||||||
|
|
||||||
|
num_clients = 1
|
||||||
|
topology = 'line'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def install(cls, mh):
|
||||||
|
tasks.install_master(cls.master, setup_dns=True)
|
||||||
|
|
||||||
|
def teardown_method(self, method):
|
||||||
|
tasks.uninstall_client(self.clients[0])
|
||||||
|
|
||||||
|
def nsswitch_backup_restore(
|
||||||
|
self,
|
||||||
|
no_sssd=False,
|
||||||
|
):
|
||||||
|
|
||||||
|
# In order to get a more pure sum, one that ignores the Generated
|
||||||
|
# header and any white space we have to do a bit of work...
|
||||||
|
sha256nsswitch_cmd = \
|
||||||
|
'egrep -v "Generated|^$" /etc/nsswitch.conf | sed "s/\\s//g" ' \
|
||||||
|
'| sort | sha256sum'
|
||||||
|
|
||||||
|
cmd = self.clients[0].run_command(sha256nsswitch_cmd)
|
||||||
|
orig_sha256 = cmd.stdout_text
|
||||||
|
|
||||||
|
grep_automount_command = \
|
||||||
|
"grep automount /etc/nsswitch.conf | cut -d: -f2"
|
||||||
|
|
||||||
|
tasks.install_client(self.master, self.clients[0])
|
||||||
|
cmd = self.clients[0].run_command(grep_automount_command)
|
||||||
|
after_ipa_client_install = cmd.stdout_text.split()
|
||||||
|
|
||||||
|
if no_sssd:
|
||||||
|
ipa_client_automount_command = [
|
||||||
|
"ipa-client-automount", "--no-sssd", "-U"
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
ipa_client_automount_command = [
|
||||||
|
"ipa-client-automount", "-U"
|
||||||
|
]
|
||||||
|
self.clients[0].run_command(ipa_client_automount_command)
|
||||||
|
cmd = self.clients[0].run_command(grep_automount_command)
|
||||||
|
after_ipa_client_automount = cmd.stdout_text.split()
|
||||||
|
if no_sssd:
|
||||||
|
assert after_ipa_client_automount == ['files', 'ldap']
|
||||||
|
else:
|
||||||
|
assert after_ipa_client_automount == ['sss', 'files']
|
||||||
|
|
||||||
|
cmd = self.clients[0].run_command(grep_automount_command)
|
||||||
|
assert cmd.stdout_text.split() == after_ipa_client_automount
|
||||||
|
|
||||||
|
self.clients[0].run_command([
|
||||||
|
"ipa-client-automount", "--uninstall", "-U"
|
||||||
|
])
|
||||||
|
|
||||||
|
cmd = self.clients[0].run_command(grep_automount_command)
|
||||||
|
assert cmd.stdout_text.split() == after_ipa_client_install
|
||||||
|
|
||||||
|
tasks.uninstall_client(self.clients[0])
|
||||||
|
cmd = self.clients[0].run_command(sha256nsswitch_cmd)
|
||||||
|
assert cmd.stdout_text == orig_sha256
|
||||||
|
|
||||||
|
@pytest.mark.xfail(reason='freeipa ticket 8054', strict=True)
|
||||||
|
def test_nsswitch_backup_restore_sssd(self):
|
||||||
|
self.nsswitch_backup_restore()
|
||||||
|
|
||||||
|
def test_nsswitch_backup_restore_no_sssd(self):
|
||||||
|
self.nsswitch_backup_restore(no_sssd=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user