Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Drop already ported tests from alltest #7428

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
220 changes: 0 additions & 220 deletions src/tests/multihost/alltests/test_default_debug_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,233 +12,13 @@
import time
import pytest
from sssd.testlib.common.utils import sssdTools, LdapOperations
from sssd.testlib.common.ssh2_python import check_login_client_bool
from constants import ds_instance_name, ds_suffix, ds_rootpw, ds_rootdn


@pytest.mark.usefixtures('setup_sssd', 'create_posix_usersgroups')
@pytest.mark.defaultdebuglevel
class TestDefaultDebugLevel(object):
""" Check sssd default debug level """
@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_check')
@pytest.mark.tier1_4
def test_0001_check_default_debug_level(self, multihost, backupsssdconf):
"""
:title: default debug logs: Check default debug level when sssd start
successfully
:id: 1f38b560-27dc-4144-895d-e667420b0467
:steps:
1. Remove debug_level from sssd.conf file
2. Start sssd
3. Check logs in /var/log/sssd
:expectedresults:
1. sssd should use default debug level with no level defined
2. sssd services start successfully
3. Log files has
a. default level set to 0x0070
b. 0x1f7c0 logs for "SSSDBG_IMPORTANT_INFO"
c. Other logs could be <= 0x0040
"""
section = f"domain/{ds_instance_name}"
domain_params = {'debug_level': ''}
tools = sssdTools(multihost.client[0])
tools.sssd_conf(section, domain_params, action='delete')
# stop sssd, delete sssd logs and cache, start sssd
tools.clear_sssd_cache()
time.sleep(5)
log_list = ['sssd', f'sssd_{ds_instance_name}',
'sssd_nss', 'sssd_pam']
for log_filename in log_list:
log = f'/var/log/sssd/{log_filename}.log'
log_str = multihost.client[0].get_file_contents(log).decode(
'utf-8')
print(f'\n{log_filename}\n+===++++++===+\n{log_str}\n')
pattern1 = re.compile(r'Starting with debug level = 0x0070')
default_debug = pattern1.search(log_str)
assert default_debug is not None
log_split = log_str.split("\n")
for index in range(len(log_split) - 1):
log_single_line = log_split[index]
pattern2 = re.compile(r'\(0x\w+\)')
debug_str1 = pattern2.search(log_single_line)
assert debug_str1.group() == '(0x3f7c0)'

@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_check_with_login')
@pytest.mark.tier1_4
def test_0002_check_default_level_with_auth(self, multihost,
backupsssdconf):
"""
:title: default debug logs: Check successful login with default
log level doesn't generate any logs
:id: f40a7c66-6b5f-4f3c-8fcb-6aa12f415473
:steps:
1. Remove debug_level from sssd.conf file
2. Add fallback_homedir (generates extra logs on
user auth if not specified)
3. Stop sssd, clear cache and logs, start sssd
4. Check total log size before user auth
5. Execute valid user authentication
6. Check total log size after auth
7. Log sizes before and after auth are the same
:expectedresults:
1. sssd should use default debug level with no level defined
2. Succeeds
3. sssd services start successfully
4. Succeeds
5. Succeeds
6. Succeeds
7. Succeeds
"""
section = f"domain/{ds_instance_name}"
domain_params = {'debug_level': ''}
tools = sssdTools(multihost.client[0])
tools.sssd_conf(section, domain_params, action='delete')
domain_params = {'fallback_homedir': '/home/%u'}
tools.sssd_conf(section, domain_params)
# stop sssd, delete logs and cache, start sssd
tools.clear_sssd_cache()
multihost.client[0].run_command('cat /etc/sssd/sssd.conf')
check_log_size = "du -c /var/log/sssd/ | awk '/total/ {print $1}'"
blog_size = multihost.client[0].run_command(check_log_size,
raiseonerr=False)
print("before auth:", blog_size.stdout_text)
user = f'foo1@{ds_instance_name}'
# Authenticate user
ssh = check_login_client_bool(multihost, user, 'Secret123')
alog_size = multihost.client[0].run_command(check_log_size,
raiseonerr=False)
print("after auth:", alog_size.stdout_text)
assert ssh, f'{user} is not able to login'
assert alog_size.stdout_text == blog_size.stdout_text

@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_fatal_and_critical_failures')
@pytest.mark.tier2
def test_0003_bz1893159(self, multihost, backupsssdconf):
"""
:title: default debug logs: Check that messages with levels 0 and 1
are printed with default log level
:id: 79411fe9-99d6-430b-90fd-3eff1807975f
:steps:
1. Remove debug_level from sssd.conf
2. chmod sssd.conf with 444 permissions
3. Start sssd
4. Check logs
:expectedresults:
1. sssd should use default debug level with no level defined
2. Succeeds
3. sssd fails to start
4. Logs have both 'Fatal failures' (level 0) and
'Critical failures' (level 1)
"""
section = f"domain/{ds_instance_name}"
domain_params = {'debug_level': ''}
tools = sssdTools(multihost.client[0])
tools.sssd_conf(section, domain_params, action='delete')
multihost.client[0].service_sssd('stop')
chmod_cmd = 'chmod 444 /etc/sssd/sssd.conf'
cmd = multihost.client[0].run_command(chmod_cmd, raiseonerr=False)
assert cmd.returncode == 0
tools.remove_sss_cache('/var/log/sssd')
multihost.client[0].run_command('systemctl start sssd',
raiseonerr=False)
slog = '/var/log/sssd/sssd.log'
log_str = multihost.client[0].get_file_contents(slog).decode('utf-8')
find1 = re.compile(r'0x0020')
find2 = re.compile(r'0x0010')
restore_sssd = 'chmod 600 /etc/sssd/sssd.conf'
multihost.client[0].run_command(restore_sssd, raiseonerr=False)
# Check that both 'Fatal failures' and 'Critical failures'
# messages are in the logs
if not find1.search(log_str) and not find2.search(log_str):
assert False

@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_cannot_load_sssd_config')
@pytest.mark.tier1_4
def test_0004_bz1893159(self, multihost, backupsssdconf):
"""
:title: default debug logs: Check default level 2
:id: d44d5883-fc52-418d-b407-3ac63f7104d8
:bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1893159
:setup:
1. Remove debug_level option from sssd.conf
2. Set domains = typo_domain (non existing) in [sssd] section
3. Start sssd after clearing cache and logs
:steps:
1. Check sssd.log contains log related to 'SSSD cannot load config'
:expectedresults:
1. /var/log/sssd/sssd.log contains 'SSSD couldn't load configuration' log
"""
section = f"domain/{ds_instance_name}"
domain_params = {'debug_level': ''}
tools = sssdTools(multihost.client[0])
tools.sssd_conf(section, domain_params, action='delete')
tools.sssd_conf('sssd', {'domains': 'some'}, action='update')
multihost.client[0].service_sssd('stop')
tools.remove_sss_cache('/var/log/sssd')
multihost.client[0].run_command('systemctl start sssd', raiseonerr=False)
log = '/var/log/sssd/sssd.log'
log_str = multihost.client[0].get_file_contents(log).decode('utf-8')
pattern = re.compile(r'SSSD couldn\'t load the configuration database')
assert pattern.search(log_str)

@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_nonexisting_ldap_server')
@pytest.mark.tier1_4
def test_bz1893159(self, multihost, backupsssdconf):
"""
:title: default debug logs: default log level logs in sssd.log
:id: 8f9c8c47-a1f6-4ec0-b979-202d8d6dc6c3
:bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1893159
:setup:
1. Remove debug_level option from sssd.conf
2. Set ldap_uri to a non-existing ldap-server
3. Start sssd after clearing cache and logs
:steps:
1. Check logs
:expectedresults:
1. Domain Logs should contain a log related to 'going offline'
"""
section = f"domain/{ds_instance_name}"
domain_params = {'debug_level': ''}
tools = sssdTools(multihost.client[0])
tools.sssd_conf(section, domain_params, action='delete')
tools.sssd_conf(section, {'ldap_uri': 'ldap://typo'} , action='update')
tools.clear_sssd_cache()
log = f'/var/log/sssd/sssd_{ds_instance_name}.log'
log_str = multihost.client[0].get_file_contents(log).decode('utf-8')
find = re.compile(r'Failed to connect, going offline')
#check what is logged at default debug_level(2)
assert find.search(log_str)

@pytest.mark.converted('logging.py', 'test_logging__default_debug_level_sbus')
@pytest.mark.tier1_4
def test_0005_bz1915319(self, multihost, backupsssdconf):
"""
:title: default debug logs: Check SBUS code should not trigger failure
message during modules startup
:id: 5c7b9eb7-ee89-4ed7-94d0-467de16a505f
:steps:
1. Remove debug_level from sssd.conf
2. Start sssd after clearing cache and logs
3. Check string "Unable to remove key" is not in the logs
:expectedresults:
1. sssd should use default debug level with no level defined
2. Succeeds
3. Succeeds
"""
section = f"domain/{ds_instance_name}"
domain_params = {'debug_level': ''}
tools = sssdTools(multihost.client[0])
tools.sssd_conf(section, domain_params, action='delete')
tools.clear_sssd_cache()
log_list = ['sssd', f'sssd_{ds_instance_name}',
'sssd_nss', 'sssd_pam']
for log in log_list:
log = f'/var/log/sssd/{log}.log'
log_str = multihost.client[0].get_file_contents(log).decode(
'utf-8')
find = re.compile(r'Unable to remove key.*')
assert not find.search(log_str)

@staticmethod
@pytest.mark.tier2
def test_bz785908(multihost, backupsssdconf):
Expand Down
Loading