diff --git a/src/tests/intg/Makefile.am b/src/tests/intg/Makefile.am index 0cfd268dce7..75c239a51a5 100644 --- a/src/tests/intg/Makefile.am +++ b/src/tests/intg/Makefile.am @@ -43,7 +43,6 @@ dist_noinst_DATA = \ conftest.py \ sssd_hosts.py \ sssd_nets.py \ - test_confdb.py \ test_sss_cache.py \ $(NULL) diff --git a/src/tests/intg/test_confdb.py b/src/tests/intg/test_confdb.py deleted file mode 100644 index 781c36961f9..00000000000 --- a/src/tests/intg/test_confdb.py +++ /dev/null @@ -1,158 +0,0 @@ -# -# Confdb integration tests -# -# Copyright (c) 2022 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -import os -import stat -import signal -import subprocess -import time -import pytest - -import config -from util import unindent - - -def create_conf_file(contents): - """Create sssd.conf with specified contents""" - with open(config.CONF_PATH, "w") as conf: - conf.write(contents) - os.chmod(config.CONF_PATH, stat.S_IRUSR | stat.S_IWUSR) - - -def cleanup_conf_file(): - """Remove sssd.conf, if it exists""" - if os.path.lexists(config.CONF_PATH): - os.unlink(config.CONF_PATH) - - -def create_conf_cleanup(request): - """Add teardown for removing sssd.conf""" - request.addfinalizer(cleanup_conf_file) - - -def create_conf_fixture(request, contents): - """ - Create sssd.conf with specified contents and add teardown for removing it - """ - create_conf_file(contents) - create_conf_cleanup(request) - - -def create_sssd_process(): - """Start the SSSD process""" - if subprocess.call(["sssd", "-D", "--logger=files"]) != 0: - raise Exception("sssd start failed") - - -def get_sssd_pid(): - with open(config.PIDFILE_PATH, "r") as pid_file: - pid = int(pid_file.read()) - return pid - - -def cleanup_sssd_process(): - """Stop the SSSD process and remove its state""" - try: - pid = get_sssd_pid() - os.kill(pid, signal.SIGTERM) - while True: - try: - os.kill(pid, signal.SIGCONT) - except OSError: - break - time.sleep(1) - except OSError: - # Ignore the error. - pass - for path in os.listdir(config.DB_PATH): - os.unlink(config.DB_PATH + "/" + path) - for path in os.listdir(config.MCACHE_PATH): - os.unlink(config.MCACHE_PATH + "/" + path) - - -def test_domains__domains(request): - """ - Test that SSSD starts with explicitly configured domain. - """ - conf = unindent("""\ - [sssd] - services = nss, sudo - domains = test - - [domain/test] - id_provider = proxy - proxy_lib_name = files - auth_provider = none - """) - - create_conf_fixture(request, conf) - - try: - create_sssd_process() - except Exception: - assert False - finally: - cleanup_sssd_process() - - -def test_domains__enabled(request): - """ - Test that SSSD starts without domains option. - """ - conf = unindent("""\ - [sssd] - services = nss, sudo - - [domain/test] - enabled = true - id_provider = proxy - proxy_lib_name = files - auth_provider = none - """) - - create_conf_fixture(request, conf) - - try: - create_sssd_process() - except Exception: - assert False - finally: - cleanup_sssd_process() - - -def test_domains__empty(request): - """ - Test that SSSD fails without any domain enabled. - """ - conf = unindent("""\ - [sssd] - services = nss, sudo - enable_files_domain = false - - [domain/test] - id_provider = proxy - proxy_lib_name = files - auth_provider = none - """) - - create_conf_fixture(request, conf) - with pytest.raises(Exception): - create_sssd_process() - - cleanup_sssd_process() diff --git a/src/tests/system/tests/test_files.py b/src/tests/system/tests/test_files.py index 77ca0d15f90..cd8dfa2f2c5 100644 --- a/src/tests/system/tests/test_files.py +++ b/src/tests/system/tests/test_files.py @@ -42,6 +42,45 @@ def test_files__root_user_is_ignored_on_lookups(client: Client): assert client.tools.getent.passwd("root"), "Root user is not found using all services!" +@pytest.mark.importance("low") +@pytest.mark.builtwith("files-provider") +@pytest.mark.integration +@pytest.mark.topology(KnownTopology.Client) +def test_files__sssd_starts_without_the_domain_parameter(client: Client): + """ + :title: The domain parameter is missing and is enabled in the domain section + :setup: + 1. Configure SSSD with no domain parameter and under domain 'enabled = true' + :steps: + 1. Start SSSD + :expectedresults: + 1. SSSD starts + :customerscenario: False + """ + client.sssd.sssd.remove_option("domain") + client.sssd.domain["enabled"] = "true" + assert client.sssd.start() + + +@pytest.mark.importance("low") +@pytest.mark.builtwith("files-provider") +@pytest.mark.integration +@pytest.mark.topology(KnownTopology.Client) +def test_files__sssd_starts_without_any_domains_enabled(client: Client): + """ + :title: SSSD starts without any domains enabled + :setup: + 1. Configure SSSD with 'enable_files_domain = false' + :steps: + 1. Start SSSD + :expectedresults: + 1. SSSD starts + :customerscenario: False + """ + client.sssd.sssd["enable_files_domain"] = "false" + assert client.sssd.start() + + @pytest.mark.importance("low") @pytest.mark.builtwith("files-provider") @pytest.mark.topology(KnownTopology.Client)