Skip to content

tests: updating pysss_nss_idmap error with more detail - #8797

Merged
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
danlavu:tests-pysss-error-messages
Jun 19, 2026
Merged

tests: updating pysss_nss_idmap error with more detail#8797
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
danlavu:tests-pysss-error-messages

Conversation

@danlavu

@danlavu danlavu commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@danlavu danlavu added Tests Trivial A single reviewer is sufficient to review the Pull Request backport-to-sssd-2-12 backport-to-sssd-2-13 labels Jun 10, 2026
@danlavu
danlavu requested a review from jakub-vavra-cz June 10, 2026 04:25

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request improves assertion error messages in the test_pysss_nss_idmap.py test suite by including the actual command output on failure. However, a copy-paste error was introduced in test_ignore_unreadable_references where a successful ID lookup assertion was incorrectly changed to expect an empty dictionary and a mismatched error message. This issue should be corrected as suggested.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/tests/system/tests/test_pysss_nss_idmap.py Outdated

@jakub-vavra-cz jakub-vavra-cz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@sssd-bot sssd-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review done using Claude Code / claude-opus-4-6

Functional Issues

  1. getidbysid assertion change contradicts test docstring (src/tests/system/tests/test_pysss_nss_idmap.py:391-394): The test_ignore_unreadable_references test docstring at lines 330-335 states that step 3 ("Lookup ID and name by group SID") has expected result "Group found". However, the getidbysid assertion was changed to expect an empty dict {}, meaning the group is not found. If the behavioral change is intentional (as the author states), the docstring must be updated to reflect this. Currently the test documentation says the opposite of what the test asserts.

    Suggested docstring update (around line 334):

    :steps:
        1. Lookup group SID by name, ID, GID
        2. Lookup group SID by UID
        3. Lookup ID by group SID
        4. Lookup name by group SID
    :expectedresults:
        1. Group found
        2. Group not found
        3. Group not found
        4. Group found
    
  2. Error message still says "when queried as UID" instead of "when queried as SID" (src/tests/system/tests/test_pysss_nss_idmap.py:394): Reviewer alexey-tikhonov pointed out in the latest comment that the error message "Unexpectedly found ID for group SID '{group_id}' when queried as UID: ..." should say "when queried as SID" since getidbysid queries by SID, not by UID. This has not been addressed yet.

  3. Error message uses group_id instead of group_sid (src/tests/system/tests/test_pysss_nss_idmap.py:394): The message reads "Unexpectedly found ID for group SID '{group_id}'" but group_id is a numeric GID, not a SID string. Since the function being called is getidbysid(group_sid), the message should reference group_sid to show what was actually queried. The corrected message should be:

    f"Unexpectedly found ID for group SID '{group_sid}' when queried as SID: {output.stdout.strip()}"
  4. Inconsistency: getidbysid expects empty but getnamebysid still expects success (src/tests/system/tests/test_pysss_nss_idmap.py:391-399): Right after asserting that getidbysid(group_sid) returns {} (group not found by SID), the test asserts that getnamebysid(group_sid) returns {group_sid: {"name": group.name, "type": 2}} (group found by the same SID). Both functions query the same SID. If getidbysid truly should return empty for an unreadable reference scenario, it seems odd that getnamebysid would succeed with the same SID. Please clarify whether this inconsistency is expected behavior or whether getnamebysid should also be updated.

Nits & Non-functional Issues

  1. Inconsistent update of negative-case error messages (src/tests/system/tests/test_pysss_nss_idmap.py:389): The getsidbyuid assertion at line 389 in test_ignore_unreadable_references still uses the old-style message format (f"'{group.name}' has wrong SID {group_sid}!"), while other similar negative-case assertions in the same PR were updated to the new descriptive format. For consistency, this should also be updated to something like f"Unexpectedly found SID for group '{group.name}' when queried as UID: {output.stdout.strip()}".

  2. Old-style error messages remain on success assertions: This PR only updates error messages for assertions that expect empty results (negative cases). Many success assertions still use the old-style "has wrong SID" / "has wrong name" format (e.g., lines 96, 101, 130, 135, 191, 196, etc.) which don't include the actual output. The single exception is test_user_by_sid line 167, which was updated to the new format. The PR title says "updating pysss_nss_idmap error with more detail" -- consider whether the scope should extend to the remaining assertions for consistency, or add a note that those will be addressed separately.

  3. Missing :relnote: tag consideration: This PR only modifies test code and does not change user-visible behavior, so no :relnote: tag is needed. This is fine.

Review of Existing Review Comments

  • gemini-code-assist[bot] flagged the getidbysid assertion change as a "copy-paste error" / regression. The PR author responded that the empty-result expectation is intentional. If that is the case, this is not a copy-paste error but a deliberate test fix. However, the functional issues above (mismatched docstring, wrong variable in message, wrong "queried as" text) still need to be addressed.

  • alexey-tikhonov (first comment) noted the error message should say "Unexpectedly found ID for group SID" rather than "Unexpectedly found SID for group ID". The author acknowledged this and said it was fixed. Looking at the current code at line 394, the message now reads "Unexpectedly found ID for group SID", so this part has been addressed.

  • alexey-tikhonov (second comment, most recent) noted that "when queried as UID" should be "when queried as SID". This has not been addressed in the current code at line 394 -- the message still says "when queried as UID".

@danlavu
danlavu force-pushed the tests-pysss-error-messages branch 4 times, most recently from 0b4fbe0 to 0ba9dca Compare June 19, 2026 15:05
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Jakub Vávra <jvavra@redhat.com>
@sssd-bot

Copy link
Copy Markdown
Contributor

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 CodeQL (success)
🟡 osh-diff-scan:fedora-rawhide-x86_64:upstream (in_progress)
🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟡 rpm-build:fedora-43-x86_64:upstream (in_progress)
🟡 rpm-build:fedora-44-x86_64:upstream (in_progress)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟡 testing-farm:centos-stream-10-x86_64:upstream (in_progress)
🟡 testing-farm:fedora-43-x86_64:upstream (in_progress)
🟡 testing-farm:fedora-44-x86_64:upstream (in_progress)
🟡 testing-farm:fedora-rawhide-x86_64:upstream (in_progress)
🟢 Analyze (target) / cppcheck (success)
🟡 ci / intgcheck (centos-10) (in_progress)
🟡 ci / intgcheck (fedora-43) (in_progress)
🟡 ci / intgcheck (fedora-44) (in_progress)
🔴 ci / intgcheck (fedora-45) (failure)
🟢 ci / prepare (success)
🟡 ci / system (centos-10) (in_progress)
🟡 ci / system (fedora-43) (in_progress)
🟡 ci / system (fedora-44) (in_progress)
🔴 ci / system (fedora-45) (failure)
➖ Coverity scan / coverity (skipped)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@sssd-bot
sssd-bot force-pushed the tests-pysss-error-messages branch from 0ba9dca to 2d1bf29 Compare June 19, 2026 15:16
@alexey-tikhonov
alexey-tikhonov merged commit 2ca8395 into SSSD:master Jun 19, 2026
8 of 16 checks passed
@danlavu
danlavu deleted the tests-pysss-error-messages branch July 1, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accepted backport-to-sssd-2-12 backport-to-sssd-2-13 Tests Trivial A single reviewer is sufficient to review the Pull Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants