From dbe4159e27d44550085cb3ce0629d1e525c9b30e Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 22 Jul 2021 17:07:26 -0400 Subject: [PATCH] ipatests: Add test for ipa automountlocation-tofiles Only the first key of orphaned automount keys was being displayed. tofiles was created because making sense of LDAP automount information is a brain squeezer. The purpose is not to display in a precise file format but to display it in a sensible and understandable way. https://pagure.io/freeipa/issue/7814 Signed-off-by: Rob Crittenden Reviewed-By: Francois Cami --- ipatests/test_integration/test_commands.py | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py index 5d755998e..d64519eb7 100644 --- a/ipatests/test_integration/test_commands.py +++ b/ipatests/test_integration/test_commands.py @@ -1499,3 +1499,51 @@ class TestIPACommandWithoutReplica(IntegrationTest): ) # Run the command again after cache is removed self.master.run_command(['ipa', 'user-show', 'ipauser1']) + + +class TestIPAautomount(IntegrationTest): + @classmethod + def install(cls, mh): + tasks.install_master(cls.master, setup_dns=True) + + def test_tofiles_orphan_keys(self): + """ + Validate automountlocation-tofiles output + + automount in LDAP is difficult to keep straight so a client-side + map generator was created. + """ + tasks.kinit_admin(self.master) + + self.master.run_command( + [ + 'ipa', + 'automountmap-add', 'default', + 'auto.test' + ] + ) + self.master.run_command( + [ + 'ipa', + 'automountkey-add', 'default', + 'auto.test', + '--key', '/test', + '--info', 'nfs.example.com:/exports/test' + ] + ) + self.master.run_command( + [ + 'ipa', + 'automountkey-add', 'default', + 'auto.test', + '--key', '/test2', + '--info', 'nfs.example.com:/exports/test2' + ] + ) + result = self.master.run_command( + [ + 'ipa', 'automountlocation-tofiles', 'default' + ] + ).stdout_text + assert '/test' in result + assert '/test2' in result