Skip to content

tests: port ad_provider idmap.sh coverage to system tests - #8871

Draft
danlavu wants to merge 1 commit into
SSSD:masterfrom
danlavu:rewrite-idmap.sh
Draft

tests: port ad_provider idmap.sh coverage to system tests#8871
danlavu wants to merge 1 commit into
SSSD:masterfrom
danlavu:rewrite-idmap.sh

Conversation

@danlavu

@danlavu danlavu commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Port bash/client/ad_provider/idmap/idmap.sh into a new test_idmap.py.

  • test_idmap__ldap_provider_maps_consistently_across_restart
  • test_idmap__invalid_range_config_rejects_lookup
  • test_idmap__range_min_zero_allows_lookup
  • test_idmap__default_domain_sid_mismatch_still_maps
  • test_idmap__default_domain_sid_match_avoids_remap
  • test_idmap__invalid_default_domain_sid_rejected
  • test_idmap__autorid_compat_logs_default_sid_state
  • test_idmap__builtin_sid_debug_silenced

Co-authored-by: Cursor cursoragent@cursor.com
Model used: Sonnet 5

@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@alexey-tikhonov alexey-tikhonov self-assigned this Jul 2, 2026
@alexey-tikhonov
alexey-tikhonov self-requested a review July 2, 2026 13:06
@alexey-tikhonov alexey-tikhonov removed their assignment Jul 30, 2026
@alexey-tikhonov
alexey-tikhonov removed their request for review July 30, 2026 19:49
Port bash/client/ad_provider/idmap/idmap.sh into a new test_idmap.py.

- test_idmap__ldap_provider_maps_consistently_across_restart
- test_idmap__invalid_range_config_rejects_lookup
- test_idmap__range_min_zero_allows_lookup
- test_idmap__default_domain_sid_mismatch_still_maps
- test_idmap__default_domain_sid_match_avoids_remap
- test_idmap__invalid_default_domain_sid_rejected
- test_idmap__autorid_compat_logs_default_sid_state
- test_idmap__builtin_sid_debug_silenced

Co-authored-by: Cursor <cursoragent@cursor.com>
Model used: Sonnet 5
"""
client.sssd.start()

result = client.host.conn.run("id Administrator", raise_on_error=False)

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.

Should this use client.tools.id("Administrator")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are absolutely right, I really didn't look at them too carefully. Still in shock at how well AI wrote these test cases.


log = client.fs.read(client.sssd.logs.domain())
assert "Could not add domain" in log, "'Could not add domain' not found in the domain log!"
assert "[junk][0] to ID map" in log, "'[junk][0] to ID map' not found in the domain log!"

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.

This asserts a very specific log format including [junk][0]. If the log message format changes (e.g., spacing, order), this breaks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Like above, aside from those two things, are tests okay?

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.

AI-generated tests are impressively close to the originals. But the gaps are real,
Required changes:

  1. Missing id_provider = ldap code path coverage for 5 tests
  2. Missing idmapuser02 / idmapgroup02 with POSIX attributes coverage

Nice-to-haves (6):

  1. Missing SSH login check in test_idmap__default_domain_sid_match_avoids_remap
  2. Log clearing before id Administrator in test_idmap__builtin_sid_debug_silenced to avoid false positives from startup logs
  3. Missing domain SID verification in test_idmap__autorid_compat_logs_default_sid_state (default_sid_set_but_unrelated) — bash checks the real AD domain SID also appears in the log after user lookup

@madhuriupadhye

Copy link
Copy Markdown
Contributor

@danlavu,

  1. The id_provider = ldap cases were intentionally dropped (maybe the framework doesn't support configuring raw LDAP bind against AD easily?), or
  2. They plan to add those in a follow-up

@danlavu

danlavu commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

I took a closer look at these tests, and I really don't like them. It can also use the enhancements from SSSD/sssd-test-framework#264 so I'm moving this back to draft.

@danlavu
danlavu marked this pull request as draft August 22, 2026 21:52
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