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: housekeeping - test_logging.py #7559

Closed

Conversation

danlavu
Copy link

@danlavu danlavu commented Sep 3, 2024

housekeeping, the following is looked at and may have been done:

  • fixed typos and standardized formatting
  • renamed test cases to improve the clarity of what the test does
  • improved docstring language, setup, steps and expected results
  • synced code with the docstring order
  • removed necessary configuration relevant to the test
  • added pytest.mark.importance to test cases
  • added error messages to assertions

@danlavu danlavu added the Tests label Sep 3, 2024
@alexey-tikhonov alexey-tikhonov added the no-backport This should go to target branch only. label Sep 4, 2024
@danlavu danlavu force-pushed the tests-housekeeping-logging-2-9 branch 2 times, most recently from 99a772a to cb2a6f3 Compare September 5, 2024 18:06
@alexey-tikhonov
Copy link
Member

Is this updated to match PR that was merged to sssd-2.10?

housekeeping, the following is looked at and may have been done:

* fixed typos and standardized formatting
* renamed test cases to improve the clarity of what the test does
* improved docstring language, setup, steps and expected results
* synced code with the docstring order
* removed necessary configuration relevant to the test
* added pytest.mark.importance to test cases
* added error messages to assertions
@danlavu danlavu force-pushed the tests-housekeeping-logging-2-9 branch from cb2a6f3 to d43dbe3 Compare September 12, 2024 16:41
@danlavu
Copy link
Author

danlavu commented Sep 12, 2024

@alexey-tikhonov yes, had to re-run black for formatting and the only different is that it still contains the test for file permissions which did not write to journald

git diff master test_logging.py

diff --git a/src/tests/system/tests/test_logging.py b/src/tests/system/tests/test_logging.py
index 3be50e35b..5ad036743 100644
--- a/src/tests/system/tests/test_logging.py
+++ b/src/tests/system/tests/test_logging.py
@@ -74,6 +74,38 @@ def test_logging__default_settings_does_not_log_user_logins(client: Client):
     assert not client.host.conn.run("diff /var/log/sssd /tmp/copy").stdout, "Debug messages were generated!"
 
 
[email protected]
[email protected]("low")
[email protected](bz=1893159)
[email protected](KnownTopology.Client)
+def test_logging__default_settings_logs_sssd_conf_permissions_errors(client: Client):
+    """
+    :title: Default debug_level logs sssd.conf unreadable ssd.conf permission errors
+    :setup:
+        1. Configure SSSD for local system authentication
+        2. Start SSSD, note this configures SSSD, the config file is created here
+        3. Set invalid file permissions for sssd.conf
+        4. Stop SSSD
+    :steps:
+        1. Start SSSD with default debug level
+    :expectedresults:
+        1. SSSD failed to start with expected error code
+    :customerscenario: True
+    """
+    client.sssd.common.local()
+    client.sssd.default_domain = "local"
+    client.sssd.start(debug_level=None)
+    client.fs.chmod(mode="444", path="/etc/sssd/sssd.conf")
+    client.sssd.stop()
+
+    assert (
+        client.sssd.start(debug_level=None, raise_on_error=False, apply_config=False).rc != 0
+    ), "SSSD erroneously started!"
+    assert "File ownership and permissions check failed" in client.fs.read(
+        client.sssd.logs.monitor
+    ), "File check error messages are not in logs!"
+
+
 @pytest.mark.integration
 @pytest.mark.importance("low")
 @pytest.mark.ticket(bz=1893159)

@alexey-tikhonov
Copy link
Member

Pushed PR: #7559

  • sssd-2-9
    • 5a6093f - tests: housekeeping - test_logging.py

@danlavu danlavu deleted the tests-housekeeping-logging-2-9 branch November 4, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport This should go to target branch only. Pushed Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants