Skip to content

Conversation

@madhuriupadhye
Copy link
Contributor

Adds two new netgroup tests.

  1. test_netgroup__incomplete_triples - Verifies netgroups with missing host/user/domain fields work correctly

  2. test_netgroups__complex_hierarchy - Verifies multi-level nested netgroups resolve inherited members correctly

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

This pull request adds two valuable system tests for netgroups, covering incomplete triples and complex hierarchies. The tests are well-structured and improve coverage. I've identified a correctness issue in the assertions of test_netgroup__incomplete_triples and suggested a fix to make it more robust. Additionally, I've proposed refactoring the assertions in test_netgroups__complex_hierarchy for better conciseness and reliability. With these changes, the new tests will be excellent additions to the suite.

:customerscenario: False
"""
if not isinstance(provider, (LDAP, Samba, AD)):
raise ValueError("IPA does not support domain in netgroups")
Copy link
Contributor

Choose a reason for hiding this comment

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

Use pytest skip instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated in all test cases.


# Level 1: Base netgroups with only triples (no nested members)
ng_base1 = provider.netgroup("ng-base1").add()
ng_base1.add_member(host="host1", user="user1", domain="ldap.test")
Copy link
Contributor

Choose a reason for hiding this comment

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

There is everywhere hardcoded ldap.test domain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in all test cases.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

See inline

Adds two new netgroup tests.

1. test_netgroup__incomplete_triples -
	Verifies netgroups with missing host/user/domain fields work correctly

2. test_netgroups__complex_hierarchy -
	Verifies multi-level nested netgroups resolve inherited members correctly

Signed-off-by: Madhuri Upadhye <[email protected]>
Update all hardcoded 'ldap.test` to provider.domain.
Replaced all occurrences of raise ValueError with pytest.skip()

Signed-off-by: Madhuri Upadhye <[email protected]>
Copy link
Contributor

@ikerexxe ikerexxe left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this. I noticed the commit structure, and I think we need to clean it up before merging to maintain a clear git history and simplify cherry-picking for maintenance branches.

Commit number 2 changes code introduced in commit number 1 and it also refactors already existing code. My suggestion would be to:

  • Commit 1: pure refactoring of the original, existing tests. This commit must pass tests on its own.
  • Commit 2: add the two new test cases using the new, refactored structure.

Comment on lines 142 to 143
if not isinstance(provider, (LDAP, Samba, AD)):
raise ValueError("IPA does not support domain in netgroups")
pytest.skip("IPA does not support domain in netgroups")
Copy link
Contributor

Choose a reason for hiding this comment

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

If the marker topology is correctly written then there's no need for this code as IPA topology will not be run at all. I'd strongly suggest you to remove these lines and similar ones

4. Create a netgroup with only domain
5. Create a netgroup with missing host
6. Create a netgroup with missing user
7. Start SSSD
Copy link
Contributor

Choose a reason for hiding this comment

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

You are missing Create a netgroup with missing domain

@madhuriupadhye madhuriupadhye force-pushed the netgroup1 branch 6 times, most recently from 58d8c52 to 84ad58e Compare December 5, 2025 18:21
Fix mypy type checking errors and improve test assertions.

Changes:
- Update provider type annotations from GenericProvider to AD | LDAP | Samba
  for tests that use the domain parameter in add_member()
- Pass string names instead of objects for ng and user parameters in
  add_member() calls to avoid union type incompatibility errors
- Rename result variables (passwd_result, group_result) to avoid type
  conflicts when reusing variable for different return types
- Add descriptive assertion failure messages for easier debugging

Signed-off-by: Madhuri Upadhye <[email protected]>
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.

4 participants