ipatests: add tests for the new NFSv4 domain option of ipa-client-automount

This commit tests the--idmap-domain knob with the following behavior:
- if not present, default to IDM domain (current behavior)
- if equal to DNS (magic value), set nothing and let idmapd autodetect domain
- otherwise set Domain in idmap.conf to the value passed by this parameter

Related to: https://pagure.io/freeipa/issue/7918
Signed-off-by: François Cami <fcami@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
François Cami 2019-05-03 12:24:23 +02:00
parent 660c4984c6
commit d76737e4c6

View File

@ -9,8 +9,7 @@
* add automount direct and indirect maps * add automount direct and indirect maps
* add automount /home for the "seattle" location only * add automount /home for the "seattle" location only
* validate it is not available in another location * validate it is not available in another location
* krb5 /home for IdM users in test_krb5_nfs_manual_configuration * krb5 /home for IdM users in test_automount
* krb5 /home for IdM users in test_automount_location
* store nfs configuration in a single place * store nfs configuration in a single place
""" """
@ -189,9 +188,7 @@ class TestNFS(TestInit):
"%s:/exports/home" % nfssrv.hostname, "/home", "-v" "%s:/exports/home" % nfssrv.hostname, "/home", "-v"
]) ])
# TODO leverage users def test_automount(self):
def test_automount_location(self):
""" """
Test if ipa-client-automount behaves as expected Test if ipa-client-automount behaves as expected
""" """
@ -236,6 +233,12 @@ class TestNFS(TestInit):
# maybe re-use m1.group(0) if it exists. # maybe re-use m1.group(0) if it exists.
assert m1 is None assert m1 is None
# https://pagure.io/freeipa/issue/7918
# check whether idmapd.conf was setup using the IPA domain
automntclt.run_command([
"grep", "Domain = %s" % self.master.domain.name, "/etc/idmapd.conf"
])
time.sleep(WAIT_AFTER_INSTALL) time.sleep(WAIT_AFTER_INSTALL)
automntclt.run_command([ automntclt.run_command([
@ -243,15 +246,48 @@ class TestNFS(TestInit):
"%s:/exports/home" % nfssrv.hostname, "/home", "-v" "%s:/exports/home" % nfssrv.hostname, "/home", "-v"
]) ])
# TODO leverage users
automntclt.run_command(["umount", "-a", "-t", "nfs4"]) automntclt.run_command(["umount", "-a", "-t", "nfs4"])
result2 = automntclt.run_command([ result2 = automntclt.run_command([
'ipa-client-automount', '--uninstall', 'ipa-client-automount', '--uninstall', '-U', '--debug'
'-U', '--debug'
]) ])
m2 = re.search(r'(?<=stderr\=Failed).+', result2.stderr_text) m2 = re.search(r'(?<=stderr\=Failed).+', result2.stderr_text)
assert m2 is None assert m2 is None
time.sleep(WAIT_AFTER_UNINSTALL) time.sleep(WAIT_AFTER_UNINSTALL)
# https://pagure.io/freeipa/issue/7918
# test for --idmap-domain DNS
automntclt.run_command([
'ipa-client-automount', '--location', 'default',
'-U', '--debug', "--idmap-domain", "DNS"
])
# check whether idmapd.conf was setup properly:
# grep must not find any configured Domain.
result = automntclt.run_command(
["grep", "^Domain =", "/etc/idmapd.conf"], raiseonerr=False
)
assert result.returncode == 1
automntclt.run_command([
'ipa-client-automount', '--uninstall', '-U', '--debug'
])
# https://pagure.io/freeipa/issue/7918
# test for --idmap-domain exampledomain.net
nfs_domain = "exampledomain.net"
automntclt.run_command([
'ipa-client-automount', '--location', 'default',
'-U', '--debug', "--idmap-domain", nfs_domain
])
# check whether idmapd.conf was setup using nfs_domain
automntclt.run_command([
"grep", "Domain = %s" % nfs_domain, "/etc/idmapd.conf"
])
automntclt.run_command([
'ipa-client-automount', '--uninstall', '-U', '--debug'
])
self.cleanup() self.cleanup()