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: Test trasformation netgroup #7831

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aborah-sudo
Copy link
Contributor

@aborah-sudo aborah-sudo commented Feb 7, 2025

Test transformation net group with generic provider

client.host.conn.run(pgrep)

pid_nss2 = client.host.conn.run(pid_nss).stdout
assert pid_nss1 == pid_nss2
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add meaningfull assert message.



@pytest.mark.importance("low")
@pytest.mark.ticket(bz=1406437)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that we can drop the allocation error check and if everything else is covered elsewhere drop it altogether.

6. Verify that the SSSD processes (sssd, sssd_be, sssd_nss, sssd_pam) are still running and that the
sssd_nss process ID has not changed, indicating that SSSD has not crashed or restarted unexpectedly
:expectedresults:
1. SSSD configured with incorrect server backend
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
1. SSSD configured with incorrect server backend
1. SSSD configured with incorrect server URI

1. Depending on the type of provider (AD, IPA, Samba, or LDAP), the script updates the SSSD configuration
with an incorrect server URI (e.g., typo.dc.hostname)
2. SSSD is restarted again to apply the new configuration
3. Checks the status of the SSSD domain to ensure it is offline due to the misconfigured server
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
3. Checks the status of the SSSD domain to ensure it is offline due to the misconfigured server
3. Check the status of the SSSD domain.

:expectedresults:
1. SSSD configured with incorrect server backend
2. SSSD restarted
3. SSSD Offline
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
3. SSSD Offline
3. SSSD domain is offline

2. SSSD restarted
3. SSSD Offline
4. Pid of sssd_nss captured
5. Netgroup info cant be retrieve
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
5. Netgroup info cant be retrieve
5. Netgroup info can't be retrieved.

3. SSSD Offline
4. Pid of sssd_nss captured
5. Netgroup info cant be retrieve
6. SSSD not crashed
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
6. SSSD not crashed
6. SSSD nss responder has the same pid as before.

Comment on lines 348 to 350
result = client.tools.getent.netgroup(netgroup.name)
assert result is not None
assert result.members[0].user == "user-1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
result = client.tools.getent.netgroup(netgroup.name)
assert result is not None
assert result.members[0].user == "user-1"

Not a test step.

netgroup = provider.netgroup("ng-1").add().add_member(user=user)

result = client.tools.getent.netgroup(netgroup.name)
assert result is not None
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert result is not None
assert result is not None, "Could not get netgroup ng-1"

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

@aborah-sudo aborah-sudo changed the title Tests: Test trasformation SSSD does not crash in nss responder after … Tests: Test trasformation netgroup Feb 13, 2025
@aborah-sudo aborah-sudo force-pushed the new_net branch 3 times, most recently from a23466f to 0e5f2df Compare February 14, 2025 04:42
Comment on lines 327 to 328
1. Depending on the type of provider (AD, IPA, Samba, or LDAP), the script updates the SSSD configuration
with an incorrect server URI (e.g., typo.dc.hostname)
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no need to mention script or the type of provider. Thus, replace by: Update SSSD configuration with an incorrect server URI (e.g., typo.dc.hostname).

In addition, this belongs to setup phase.

Copy link
Contributor

Choose a reason for hiding this comment

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

This belongs to setup phase, not to steps

:title: SSSD nss responder handles correctly netgroup timeout when backend is offline
:setup:
1. A user (user-1) and a netgroup (ng-1) are created, and the user is added as a member of the netgroup
2. SSSD is restarted with a clean configuration to ensure no stale data is present
Copy link
Contributor

Choose a reason for hiding this comment

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

SSSD should be restarted only once, and it should be after the configuration has been updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

This also belongs to setup phase, not to steps

Comment on lines 333 to 334
6. Verify that the SSSD processes (sssd, sssd_be, sssd_nss, sssd_pam) are still running and that the
sssd_nss process ID has not changed, indicating that SSSD has not crashed or restarted unexpectedly
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this step necessary? What is the added value it brings us?

pid_nss1 = client.host.conn.run(pid_nss).stdout

# request for netgroup
assert not client.tools.getent.netgroup(netgroup.name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert not client.tools.getent.netgroup(netgroup.name)
assert not client.tools.getent.netgroup(netgroup.name), f"Netgroup {netgroup.name} was unexpectedly retrieved."

Comment on lines 385 to 393
:steps:
1. The getent command is used to retrieve the netgroup information and user is member of the netgroup
2. Wait for 30 seconds to allow the cache to expire and be refreshed
3. The ldbsearch command is used to query the SSSD cache database (cache_test.ldb)
to verify that second user is now part of the netgroup in the cache
:expectedresults:
1. Retrieves the netgroup information and user is member of the netgroup
2. Successfully wait
3. Second user is now part of the netgroup in the cache
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
:steps:
1. The getent command is used to retrieve the netgroup information and user is member of the netgroup
2. Wait for 30 seconds to allow the cache to expire and be refreshed
3. The ldbsearch command is used to query the SSSD cache database (cache_test.ldb)
to verify that second user is now part of the netgroup in the cache
:expectedresults:
1. Retrieves the netgroup information and user is member of the netgroup
2. Successfully wait
3. Second user is now part of the netgroup in the cache
:steps:
1. The getent command succeds in retrieving the netgroup
2. Verify that user is member of the netgroup
3. Wait for 30 seconds to allow the cache to expire and be refreshed.
The ldbsearch command is used to query the SSSD cache database (cache_test.ldb)
to verify that second user is now part of the netgroup in the cache
:expectedresults:
1. Retrieved the netgroup information
2. User is member of the netgroup
3. Second user is now part of the netgroup in the ldb cache

Comment on lines +414 to +418
triple = netgrp.get("netgroupTriple")
assert triple is not None, "Empty tripple!"
assert user2.name in triple[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this? Should not we check user is in ng-1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that what i am doing here

Copy link
Contributor

Choose a reason for hiding this comment

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

So what is "netgroupTriple" ? You are not creating it nor mentioning in the steps.
Can You clarify the steps/results. Why is there suddenly triple instead of ng-1?

…netgroup timeout when backend is offline

SSSD does not crash in nss responder after netgroup timeout when backend is offline

# Check backend status
assert client.sssd.default_domain is not None, "Failed to load default domain!"
assert not client.sssctl.domain_status(client.sssd.default_domain)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a failure message indicating what failed in this assert

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