ipatests: fix test_backup_and_restore.py::TestBackupAndRestore

The test test_backup_and_restore.py::TestBackupAndRestore
test_full_backup_and_restore_with_selinux_booleans_off
requires SELinux to be enabled because it's using
getsebool command.

Skip the test if SELinux is disabled.

Fixes: https://pagure.io/freeipa/issue/7970
Reviewed-By: Tibor Dudlak <tdudlak@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Florence Blanc-Renaud 2019-06-07 15:33:01 +02:00 committed by Rob Crittenden
parent 10b721d118
commit 6ec3c84c0c

View File

@ -27,6 +27,7 @@ import pytest
from ipaplatform.constants import constants from ipaplatform.constants import constants
from ipaplatform.paths import paths from ipaplatform.paths import paths
from ipaplatform.tasks import tasks as platformtasks
from ipapython.dn import DN from ipapython.dn import DN
from ipapython import ipautil from ipapython import ipautil
from ipatests.test_integration.base import IntegrationTest from ipatests.test_integration.base import IntegrationTest
@ -227,6 +228,9 @@ class TestBackupAndRestore(IntegrationTest):
finally: finally:
self.master.run_command(['userdel', 'ipatest_user1']) self.master.run_command(['userdel', 'ipatest_user1'])
@pytest.mark.skipif(
not platformtasks.is_selinux_enabled(),
reason="Test needs SELinux enabled")
def test_full_backup_and_restore_with_selinux_booleans_off(self): def test_full_backup_and_restore_with_selinux_booleans_off(self):
"""regression test for https://fedorahosted.org/freeipa/ticket/4157""" """regression test for https://fedorahosted.org/freeipa/ticket/4157"""
with restore_checker(self.master): with restore_checker(self.master):