mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-28 09:06:44 -06:00
ipatests: add a test for ipa-client-automount
Add an automount location then configure a client to use it. Only runs nightly. Related-to: https://pagure.io/freeipa/issue/7780 Related-to: https://pagure.io/freeipa/issue/7781 Related to: https://pagure.io/freeipa/issue/7783 Signed-off-by: François Cami <fcami@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
6a56aa6d49
commit
7c0b0f3471
@ -1146,3 +1146,15 @@ jobs:
|
||||
template: *ci-master-f29
|
||||
timeout: 3600
|
||||
topology: *master_1repl
|
||||
|
||||
fedora-29/test_automount_locations:
|
||||
requires: [fedora-29/build]
|
||||
priority: 50
|
||||
job:
|
||||
class: RunPytest
|
||||
args:
|
||||
build_url: '{fedora-29/build_url}'
|
||||
test_suite: test_integration/test_automount_locations.py
|
||||
template: *ci-master-f29
|
||||
timeout: 6300
|
||||
topology: *master_1repl
|
||||
|
84
ipatests/test_integration/test_automount_locations.py
Normal file
84
ipatests/test_integration/test_automount_locations.py
Normal file
@ -0,0 +1,84 @@
|
||||
#
|
||||
# Copyright (C) 2018 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
|
||||
"""This module provides tests for the automount location feature.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import time
|
||||
import re
|
||||
|
||||
from ipatests.test_integration.base import IntegrationTest
|
||||
from ipatests.pytest_ipa.integration import tasks
|
||||
|
||||
# give some time for units to stabilize
|
||||
# otherwise we get transient errors
|
||||
WAIT_AFTER_INSTALL = 5
|
||||
WAIT_AFTER_UNINSTALL = WAIT_AFTER_INSTALL
|
||||
|
||||
|
||||
class TestAutomountInstallUninstall(IntegrationTest):
|
||||
"""
|
||||
Test if ipa-client-automount behaves as expected
|
||||
"""
|
||||
|
||||
num_replicas = 1
|
||||
topology = 'star'
|
||||
|
||||
@classmethod
|
||||
def install(cls, mh):
|
||||
tasks.install_master(cls.master, setup_dns=False)
|
||||
client = cls.replicas[0]
|
||||
tasks.install_client(cls.master, client)
|
||||
|
||||
def test_use_automount_location(self):
|
||||
|
||||
client = self.replicas[0]
|
||||
|
||||
self.master.run_command([
|
||||
"ipa", "automountlocation-add", "baltimore"
|
||||
])
|
||||
|
||||
self.master.run_command([
|
||||
"ipa", "host-mod", client.hostname,
|
||||
"--location", "baltimore"
|
||||
])
|
||||
|
||||
# systemctl non-fatal errors will only be displayed
|
||||
# if ipa-client-automount is launched with --debug
|
||||
result1 = client.run_command([
|
||||
'ipa-client-automount', '--location', 'baltimore',
|
||||
'-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)
|
||||
|
||||
result2 = client.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.master.run_command([
|
||||
"ipa", "host-mod", client.hostname,
|
||||
"--location", "''"
|
||||
])
|
||||
|
||||
self.master.run_command([
|
||||
"ipa", "automountlocation-del", "baltimore"
|
||||
])
|
Loading…
Reference in New Issue
Block a user