Skip to content

Tests: Clean sweep in logging suite#8512

Open
jakub-vavra-cz wants to merge 1 commit intoSSSD:masterfrom
jakub-vavra-cz:sweep_logging
Open

Tests: Clean sweep in logging suite#8512
jakub-vavra-cz wants to merge 1 commit intoSSSD:masterfrom
jakub-vavra-cz:sweep_logging

Conversation

@jakub-vavra-cz
Copy link
Contributor

Revisiting changes from #7891.

@alexey-tikhonov
Copy link
Member

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request primarily refactors and expands SSSD logging tests. It clarifies documentation regarding default debug levels, renames several existing tests for better readability, and introduces new tests to verify that configured domain debug levels are honored and that debug levels can be changed at runtime using sssctl. Additionally, it improves existing tests for domain configuration errors and offline scenarios by making assertions more precise and including checks for syslog messages. A review comment highlights an inaccuracy in a test's docstring regarding the expected debug level, which should be updated to reflect the correct cumulative bitmask.

@pytest.mark.importance("low")
@pytest.mark.topology(KnownTopologyGroup.AnyProvider)
@pytest.mark.skip(reason="There are some error messages that need to have log level increased.")
def test_logging__user_logins_are_not_written_to_logs(client: Client, provider: GenericProvider):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the convention: '_' or '__'?
Above you used

test_logging_debug_level_is_written_to_logs

-- single '_'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I undestand it, before "__" is common prefix denoting test area that can be used to select tests instead of having many (outdated) pytest markes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why then test_logging__user_logins_are_not_written_to_logs but test_logging_debug_level_is_written_to_logs?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a typo, the naming convention is filename__test_case_name

@alexey-tikhonov
Copy link
Member

In general looks good to me, a couple of remarks inline.

Merged tests for sssd offline message in logs and syslog.
Split backend offline(unreachable) and dns resolution error scenario.
Check that user login does not generate logs on default debug level
extended to all providers. Added link to debug level documentation.
Dropped references to (now-irrelevant) bugzillas in rewritten tests.

Skipping test_logging__user_logins_are_not_written_to_logs
as updating log level of the messages is low priority.
Copy link

@danlavu danlavu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nitpicks, some comments, but overall, it's great, thank you.

@pytest.mark.importance("low")
@pytest.mark.topology(KnownTopology.Client)
def test_logging__default_settings_does_not_log_user_logins(client: Client):
def test_logging_debug_level_is_written_to_logs(client: Client):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing _ , test_logging__

@pytest.mark.integration
@pytest.mark.importance("low")
@pytest.mark.topology(KnownTopology.Client)
def test_logging_change_debug_level_during_runtime(client: Client):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing _ , test_logging__

client.sssd.start(debug_level=None)

log_str = client.fs.read(client.sssd.logs.domain())
sssctl_set = client.host.conn.run("sssctl debug-level --domain local 9")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be replaced with client.sssctl.debug_level(level=9, domain="local")

@pytest.mark.importance("low")
@pytest.mark.topology(KnownTopologyGroup.AnyProvider)
@pytest.mark.skip(reason="There are some error messages that need to have log level increased.")
def test_logging__user_logins_are_not_written_to_logs(client: Client, provider: GenericProvider):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a typo, the naming convention is filename__test_case_name

2. Configure SSSD for system authentication
3. Clear cache and logs and start SSSD with default debug level
:steps:
1. Store current logs and authenticate as a user.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, no period at the end, as long as it's consistent in the file.

3. Clear cache and logs and start SSSD with default debug level
:steps:
1. Store current logs and authenticate as a user.
2. Compare stored logs with the current ones.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, .

2. The login event did not generate any new log lines
:customerscenario: False
"""
# IPA
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that the error message is different. Does the test need to be updated based on the provider? If we leave the test as is, the comments aren't helpful.

@pytest.mark.ticket(bz=1416150)
@pytest.mark.topology(KnownTopology.LDAP)
def test_logging__default_settings_logs_to_syslog_when_ldap_is_offline(client: Client):
def test_logging_offline_errors_are_written_to_logs_and_syslog(client: Client, ldap: LDAP):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing _ , test_logging__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants